Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SallyDa committed Nov 26, 2024
1 parent 03b6fff commit 6f388e9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ sodym dependencies are managed with [pip](https://pypi.org/project/pip/).

To install as a user: run `python -m pip install sodym@git+https://github.com/pik-piam/sodym.git`

To install as a developer, assuming you already have python installed:
To install as a developer:

1. Clone the sodym repository using git.
2. From the project main directory, run `pip install -e ".[test]"` to obtain all the necessary
dependencies, including those for running the tests.
2. From the project main directory, run `pip install -e ".[test,docs,examples]"` to obtain all the necessary
dependencies, including those for running the tests, making the documentation, and running the examples.

Note that it is advisable to do this within a virtual environment.

Expand Down
4 changes: 2 additions & 2 deletions tests/test_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_validate_dimension_set():
# example valid DimensionSet
dimensions = [
{'name': 'time', 'letter': 't', 'items': [1990, 2000, 2010]},
{'name': 'place', 'letter': 'p', 'items': ['World', ]}
{'name': 'place', 'letter': 'p', 'items': ['World']}
]
DimensionSet(dim_list=dimensions)

Expand All @@ -24,7 +24,7 @@ def test_validate_dimension_set():
def test_get_subset():
subset_dimensions = [
{'name': 'time', 'letter': 't', 'items': [1990, 2000, 2010]},
{'name': 'place', 'letter': 'p', 'items': ['World', ]},
{'name': 'place', 'letter': 'p', 'items': ['World']},
]
material_dimension = {'name': 'material', 'letter': 'm', 'items': ['material_0', 'material_1']}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
dimension_set = DimensionSet(
dim_list = [
{'name': 'time', 'letter': 't', 'items': [1990, 2000, 2010]},
{'name': 'place', 'letter': 'p', 'items': ['World', ]}
{'name': 'place', 'letter': 'p', 'items': ['World']}
]
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_mfa_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_validate_mfa_definition():
processes=[],
flows=[],
stocks=[
{'name': 'stock_zero', 'dim_letters': ('t', )},
{'name': 'stock_zero', 'dim_letters': ('t')},
],
parameters=[],
)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_named_dim_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def test_named_dim_array_validations():
dims = DimensionSet(dim_list=[local_places, time])

# example with values with the correct shape
NamedDimArray(name='numbers', dims=dims, values=np.array([[1, 2, 3], ]))
NamedDimArray(name='numbers', dims=dims, values=np.array([[1, 2, 3]]))

# example with dimensions reversed
with pytest.raises(ValidationError):
NamedDimArray(name='numbers', dims=dims, values=np.array([[1], [2], [3], ]))
NamedDimArray(name='numbers', dims=dims, values=np.array([[1], [2], [3]]))

# example with too many values
with pytest.raises(ValidationError):
NamedDimArray(name='numbers', dims=dims, values=np.array([[1, 2, 3, 4], ]))
NamedDimArray(name='numbers', dims=dims, values=np.array([[1, 2, 3, 4]]))

# example with no values passed -> filled with zeros
zero_values = NamedDimArray(name='numbers', dims=dims)
Expand Down

0 comments on commit 6f388e9

Please sign in to comment.