Closed heikoklein closed 3 months ago
Describe the bug Several functions in https://github.com/metno/pyaerocom/blob/main-dev/pyaerocom/io/mscw_ctm/additional_variables.py have illogical signatures and/or input-parameter tests, all marked with # pragma: no cover.
# pragma: no cover
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L56 Illogical varargs signature which then is enforced to exactly one arg, it should be change to
def calc_concNhno3(conchno3: xr.DataArray) -> xr.DataArray:
and then doesn't require further testing.
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L130 same as above
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L144 same as above
Some minor cases, which are stricter than really required:
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L8 add_dataarray should be able to run with only 1 array as input. sum(3)=3 and very well defined. Currently, at least 2 arrays are required. Maybe even better without ValueError tests and a signature like
def add_dataarrays(ar0: xrDataArray, *arrs: xr.DataArray) -> xr.DataArray:
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L31 is also well defined with only one array. subtract(3)=3, subtract(3,1)= 2, ... Currently, at least 2 arrays are required. Could be solved as above.
xr.DataArray is a mutable object. Therefore, we should be careful to not to modify the input variable. Also, some of these functions would benefit from an assertion on the input units
xr.DataArray
Describe the bug Several functions in https://github.com/metno/pyaerocom/blob/main-dev/pyaerocom/io/mscw_ctm/additional_variables.py have illogical signatures and/or input-parameter tests, all marked with
# pragma: no cover
.https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L56 Illogical varargs signature which then is enforced to exactly one arg, it should be change to
and then doesn't require further testing.
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L130 same as above
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L144 same as above
Some minor cases, which are stricter than really required:
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L8 add_dataarray should be able to run with only 1 array as input. sum(3)=3 and very well defined. Currently, at least 2 arrays are required. Maybe even better without ValueError tests and a signature like
https://github.com/metno/pyaerocom/blob/5aa165d29f55f7a3cb72435c1286b107e48392f6/pyaerocom/io/mscw_ctm/additional_variables.py#L31 is also well defined with only one array. subtract(3)=3, subtract(3,1)= 2, ... Currently, at least 2 arrays are required. Could be solved as above.