-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot convert from 'centimeter' ([length]) to 'millimeter / second' ([length] / [time]) #320
Comments
Dear Eva,
The first thing would be to install the latest release of icclim. The current version is icclim 7.0.0.
… On Aug 13, 2024, at 10:53 PM, Eva Sinha ***@***.***> wrote:
icclim version: 5.4.0
Python version: 3.9.13
Description
Minimal reproducible example
snow_depth = icclim.SD(in_files=listOfFileNames, slice_mode='year')
Output received
2024-08-13 13:43:18,425 --- icclim 5.4.0
2024-08-13 13:43:18,425 --- BEGIN EXECUTION
2024-08-13 13:43:18,425 Processing: 0%
2024-08-13 13:43:59,941 Calculating climate index: SD1
/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/core/cfchecks.py:48: UserWarning: Variable does not have a `standard_name` attribute.
check_valid(vardata, "standard_name", data["standard_name"])
/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/core/units.py:729: UserWarning: Data units millimeter / second are not compatible with requested [length].
check_units(val, bound_units.arguments.get(name, None))
Traceback (most recent call last):
File "/qfs/people/sinh210/wrk/E3SM_SFA/E3SM-GCAM-GMD-2023/workflow/icclim/icclim_ELM.py", line 144, in <module>
icclim.index(index_name = key,
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/icclim/main.py", line 290, in index
result_ds = _compute_standard_climate_index(
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/icclim/main.py", line 446, in _compute_standard_climate_index
result_da, percentiles_da = compute()
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/icclim/main.py", line 414, in compute
res = climate_index.compute(conf)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/icclim/ecad/ecad_indices.py", line 412, in <lambda>
compute=lambda c: sd1(c),
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/icclim/ecad/ecad_functions.py", line 398, in sd1
result = land.snow_cover_duration(
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/core/indicator.py", line 838, in __call__
outs = self.compute(**compute_das, **kwargs, **var_kwargs)
File "<boltons.funcutils.FunctionBuilder-31>", line 2, in snow_cover_duration
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/core/units.py", line 731, in wrapper
out = func(*args, **kwargs)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/indices/_threshold.py", line 1461, in snow_cover_duration
thresh = convert_units_to(thresh, snd)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/xclim/core/units.py", line 302, in convert_units_to
return q.to(tu).m
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/quantity.py", line 716, in to
magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/quantity.py", line 665, in _convert_magnitude_not_inplace
return self._REGISTRY.convert(self._magnitude, self._units, other)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/registry.py", line 1044, in convert
return self._convert(value, src, dst, inplace)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/registry.py", line 1959, in _convert
return super()._convert(value, src, dst, inplace)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/registry.py", line 1566, in _convert
return super()._convert(value, src, dst, inplace)
File "/qfs/people/sinh210/.conda/envs/py37/lib/python3.9/site-packages/pint/registry.py", line 1077, in _convert
raise DimensionalityError(src, dst, src_dim, dst_dim)
pint.errors.DimensionalityError: Cannot convert from 'centimeter' ([length]) to 'millimeter / second' ([length] / [time])
—
Reply to this email directly, view it on GitHub <#320>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABXZ3SWHYMVHROWXGY567ADZRJW3TAVCNFSM6AAAAABMPBCOYCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3DIMJZHA3TINI>.
You are receiving this because you are subscribed to this thread.
|
@pagecp I updated icclim to the latest version (7.0.0) but am still getting the same error message. |
@evasinha it seems that your input files have units as a rate and not as a depth (Cannot convert from 'centimeter' ([length]) to 'millimeter / second' ([length] / [time]))
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
For calculating indexes using SNOW, icclim was giving the error
errors.DimensionalityError: Cannot convert from 'centimeter' ([length]) to 'millimeter / second' ([length] / [time])
SNOW is the unit if mm/s in my input files.
Minimal reproducible example
snow_depth = icclim.SD(in_files=listOfFileNames, slice_mode='year')
Output received
The text was updated successfully, but these errors were encountered: