climix issueshttps://git.smhi.se/groups/climix/-/issues2023-09-11T09:45:30Zhttps://git.smhi.se/climix/climix/-/issues/327Investigate the behaviour of FirstOccurrence and LastOccurence2023-09-11T09:45:30ZCarolina NilssonInvestigate the behaviour of FirstOccurrence and LastOccurenceThe expected output of the index functions FirstOccurrence and LastOccurrence needs to be further investigated. FirstOccurrence call_func returns 0 for the first day. This does not match up with the output from Last Occurrence call_func ...The expected output of the index functions FirstOccurrence and LastOccurrence needs to be further investigated. FirstOccurrence call_func returns 0 for the first day. This does not match up with the output from Last Occurrence call_func that returns 1 for the first day. The output is then post process which may change the end result. Therefor, further investigation of the final output is needed to estimate if both functions are working as expected.https://git.smhi.se/climix/climix/-/issues/326The call function does not work for spell function: Spell_Length2023-06-18T12:04:47ZCarolina NilssonThe call function does not work for spell function: Spell_LengthThe call function for spell function spell_length does not work and should probably be either removed or fixed.The call function for spell function spell_length does not work and should probably be either removed or fixed.https://git.smhi.se/climix/climix/-/issues/324Issue when running climix API - dask issue?2023-06-15T10:02:59ZRenate WilckeIssue when running climix API - dask issue?When I run my little example script I get the following error that repeats a lot until I cancel (ctr c).
Example script:
/home/sm_renwi/Scripts/heatwavefuture/summerseason/seasonlength_paket/seasonlength/example_error_memoryview.py
/hom...When I run my little example script I get the following error that repeats a lot until I cancel (ctr c).
Example script:
/home/sm_renwi/Scripts/heatwavefuture/summerseason/seasonlength_paket/seasonlength/example_error_memoryview.py
/home/sm_renwi/Scripts/heatwavefuture/summerseason/seasonlength_paket/control_SLENS_seasonlength.yml
Error message in ipython when running "indexcube.data" after calculating indexcube:
```
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[21], line 1
----> 1 indexcube.data
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/iris/cube.py:2462, in Cube.data(self)
2429 @property
2430 def data(self):
2431 """
2432 The :class:`numpy.ndarray` representing the multi-dimensional data of
2433 the cube.
(...)
2460
2461 """
-> 2462 return self._data_manager.data
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/iris/_data_manager.py:206, in DataManager.data(self)
203 if self.has_lazy_data():
204 try:
205 # Realise the lazy data.
--> 206 result = as_concrete_data(self._lazy_array)
207 # Assign the realised result.
208 self._real_array = result
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/iris/_lazy_data.py:279, in as_concrete_data(data)
262 """
263 Return the actual content of a lazy array, as a numpy array.
264 If the input data is a NumPy `ndarray` or masked array, return it
(...)
276
277 """
278 if is_lazy_data(data):
--> 279 (data,) = _co_realise_lazy_arrays([data])
281 return data
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/iris/_lazy_data.py:242, in _co_realise_lazy_arrays(arrays)
227 def _co_realise_lazy_arrays(arrays):
228 """
229 Compute multiple lazy arrays and return a list of real values.
230
(...)
240
241 """
--> 242 computed_arrays = da.compute(*arrays)
243 results = []
244 for lazy_in, real_out in zip(arrays, computed_arrays):
245 # Ensure we always have arrays.
246 # Note : in some cases dask (and numpy) will return a scalar
247 # numpy.int/numpy.float object rather than an ndarray.
248 # Recorded in https://github.com/dask/dask/issues/2111.
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/base.py:600, in compute(traverse, optimize_graph, scheduler, get, *args, **kwargs)
597 postcomputes.append(x.__dask_postcompute__())
599 results = schedule(dsk, keys, **kwargs)
--> 600 return repack([f(r, *a) for r, (f, a) in zip(results, postcomputes)])
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/base.py:600, in <listcomp>(.0)
597 postcomputes.append(x.__dask_postcompute__())
599 results = schedule(dsk, keys, **kwargs)
--> 600 return repack([f(r, *a) for r, (f, a) in zip(results, postcomputes)])
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/array/core.py:1283, in finalize(results)
1281 while isinstance(results2, (tuple, list)):
1282 if len(results2) > 1:
-> 1283 return concatenate3(results)
1284 else:
1285 results2 = results2[0]
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/array/core.py:5300, in concatenate3(arrays)
5298 if not ndim:
5299 return arrays
-> 5300 chunks = chunks_from_arrays(arrays)
5301 shape = tuple(map(sum, chunks))
5303 def dtype(x):
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/array/core.py:5087, in chunks_from_arrays(arrays)
5084 return (1,)
5086 while isinstance(arrays, (list, tuple)):
-> 5087 result.append(tuple(shape(deepfirst(a))[dim] for a in arrays))
5088 arrays = arrays[0]
5089 dim += 1
File ~/.conda/envs/climix_testconda/lib/python3.10/site-packages/dask/array/core.py:5087, in <genexpr>(.0)
5084 return (1,)
5086 while isinstance(arrays, (list, tuple)):
-> 5087 result.append(tuple(shape(deepfirst(a))[dim] for a in arrays))
5088 arrays = arrays[0]
5089 dim += 1
IndexError: tuple index out of range
```
Error message in terminal:
```
/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 43663 instead
warnings.warn(
/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 43577 instead
warnings.warn(
2023-06-15 10:53:40,552 - distributed.nanny - ERROR - Failed to start process
Traceback (most recent call last):
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/nanny.py", line 443, in instantiate
result = await self.process.start()
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/nanny.py", line 713, in start
await self.process.start()
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/process.py", line 55, in _call_and_set_future
res = func(*args, **kwargs)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/site-packages/distributed/process.py", line 215, in _start
process.start()
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/context.py", line 288, in _Popen
return Popen(process_obj)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/home/sm_renwi/.conda/envs/climix_testconda/lib/python3.10/multiprocessing/spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
```https://git.smhi.se/climix/climix/-/issues/319Consistent period specification2023-05-16T09:07:50ZCarolina NilssonConsistent period specificationThere are some differences in the period specification classes (seasonal, monthly, annual), e.g. first_month_number does only exist for annual. This can cause problems when running different index functions that utilise these features.There are some differences in the period specification classes (seasonal, monthly, annual), e.g. first_month_number does only exist for annual. This can cause problems when running different index functions that utilise these features.https://git.smhi.se/climix/climix/-/issues/318Missing value threshold in config2023-05-11T13:42:06ZErik HolmgrenMissing value threshold in configAdd a config option to set the threshold for the allowed amount of missing data. This could for example allow the user to decide how many days in a running window can be missing for the calculation to still be valid.Add a config option to set the threshold for the allowed amount of missing data. This could for example allow the user to decide how many days in a running window can be missing for the calculation to still be valid.https://git.smhi.se/climix/climix/-/issues/317Quality flag: missing data in output2024-02-02T10:29:22ZErik HolmgrenQuality flag: missing data in outputAs discussed during the technical meeting. Possibly add a flag which when toggled adds information about the amount of missing data to the output of Climix.As discussed during the technical meeting. Possibly add a flag which when toggled adds information about the amount of missing data to the output of Climix.https://git.smhi.se/climix/climix/-/issues/315Indicators calculated given a condition2023-05-08T07:51:08ZJohan SödlingIndicators calculated given a conditionIn some projects I have need of calculating indices given some condition, for example the number of zero crossings during the vegetation period, or accumulated precipitation given temperature > 0. More generally, it would be nice if Clim...In some projects I have need of calculating indices given some condition, for example the number of zero crossings during the vegetation period, or accumulated precipitation given temperature > 0. More generally, it would be nice if Climix supported calculating any index X given some condition Y, where Y is just a filter for which timesteps to use.https://git.smhi.se/climix/climix/-/issues/309Fix masked input data handeling in index functions2023-09-18T09:39:55ZCarolina NilssonFix masked input data handeling in index functionsThe handeling of masked input data needs to be reviewed for all of the index functions.
Here, we need to the decide on the expected behaviour of each index function. We need to decide that either, if there is one masked grid-cell the th...The handeling of masked input data needs to be reviewed for all of the index functions.
Here, we need to the decide on the expected behaviour of each index function. We need to decide that either, if there is one masked grid-cell the the output should be masked for that grid-cell or if there should be some limit for how many values that can be masked and then how this can be used in the computations. E.g., there could be some pre-processing step that checks the quality of the data and masks all values for that grid-cell which do not fulfill the conditions etc.https://git.smhi.se/climix/climix/-/issues/308Check if tasmin>tasmax2023-04-20T14:33:44ZCarolina NilssonCheck if tasmin>tasmaxSome index functions relies on the fact that tasmin should be less than tasmax. This is not always the case and we need to handle this situation in some sense. E.g., index functions count_level_crossings and diurnal_temperature_range.
S...Some index functions relies on the fact that tasmin should be less than tasmax. This is not always the case and we need to handle this situation in some sense. E.g., index functions count_level_crossings and diurnal_temperature_range.
Suqgested solution: return masked or NaN values and throw some warning.https://git.smhi.se/climix/climix/-/issues/303Climix configuration2024-02-02T10:33:03ZCarolina NilssonClimix configurationClimix now has a configuration file, climix_config.yml, which opens the possibility to include configurations. To allow some sort of merging for different configuration files can be beneficial in the context of a wider Climix configurati...Climix now has a configuration file, climix_config.yml, which opens the possibility to include configurations. To allow some sort of merging for different configuration files can be beneficial in the context of a wider Climix configuration handling. This needs to be further discussed.https://git.smhi.se/climix/climix/-/issues/302Allow a more fine-grained division of periods than months2024-02-02T13:43:11ZLars BärringAllow a more fine-grained division of periods than monthsNow and then we have had requests for computing indices based on some other period than can be specified by whole months, e.g. counting the number of dry days between April 15 and end of June, just to mention one example.Now and then we have had requests for computing indices based on some other period than can be specified by whole months, e.g. counting the number of dry days between April 15 and end of June, just to mention one example.https://git.smhi.se/climix/climix/-/issues/300Non lazy cubes throws empty assertion error2024-02-02T12:04:47ZErik HolmgrenNon lazy cubes throws empty assertion errorWe touched upon this during the last stand-up. I now came across it again working with some station data - cubes created from csv via pandas. Simply adding `cube.data = cube.lazy_data()` solves it. But maybe we should add our own more in...We touched upon this during the last stand-up. I now came across it again working with some station data - cubes created from csv via pandas. Simply adding `cube.data = cube.lazy_data()` solves it. But maybe we should add our own more informative error, or just make sure that data is lazy? Full traceback below.
```
AssertionError Traceback (most recent call last)
Cell In [122], line 1
----> 1 index([cube], client=client)
File ~/dev/climix/climix/index.py:52, in Index.__call__(self, cubes, client, sliced_mode)
50 self.index_function.prepare(cube_mapping)
51 logging.debug("Setting up aggregation")
---> 52 aggregated = multicube_aggregated_by(
53 cube_mapping,
54 coord_name,
55 self.aggregator,
56 period=self.period,
57 client=client,
58 sliced_mode=sliced_mode,
59 output_metadata=self.metadata.output,
60 )
61 aggregated.attributes["frequency"] = self.period.label
62 return aggregated
File ~/dev/climix/climix/iris.py:148, in multicube_aggregated_by(cubes, coords, aggregator, **kwargs)
145 aggregateby_cube.add_aux_coord(coord.copy(), ref_cube.coord_dims(coord))
147 # Attach the aggregate-by data into the aggregate-by cube.
--> 148 aggregateby_cube = aggregator.post_process(
149 aggregateby_cube, aggregateby_data, coords, **kwargs
150 )
152 return aggregateby_cube
File ~/dev/climix/climix/aggregators.py:65, in PointLocalAggregator.post_process(self, cube, data, coords, client, sliced_mode, **kwargs)
64 def post_process(self, cube, data, coords, client, sliced_mode, **kwargs):
---> 65 data = self.compute_pre_result(data, client, sliced_mode)
66 try:
67 post_processor = self.index_function.post_process
File ~/dev/climix/climix/aggregators.py:59, in PointLocalAggregator.compute_pre_result(self, data, client, sliced_mode)
57 logging.debug("Setting up pre-result in aggregate mode")
58 start = time.time()
---> 59 data = client.persist(data)
60 end = time.time()
61 logging.debug(f"Setup completed in {end - start:4.0f}")
File ~/miniconda3/lib/python3.10/site-packages/distributed/client.py:3437, in Client.persist(self, collections, optimize_graph, workers, allow_other_workers, resources, retries, priority, fifo_timeout, actors, **kwargs)
3434 singleton = True
3435 collections = [collections]
-> 3437 assert all(map(dask.is_dask_collection, collections))
3439 dsk = self.collections_to_dsk(collections, optimize_graph, **kwargs)
3441 names = {k for c in collections for k in flatten(c.__dask_keys__())}
AssertionError:
```https://git.smhi.se/climix/climix/-/issues/297Extend index function "interday_diurnal_temperature_range" to take a reducer ...2024-02-02T10:33:48ZLars BärringExtend index function "interday_diurnal_temperature_range" to take a reducer as argumentThis extension would enable e.g. `maximum` as an alternative reducer to the currently hardcoded `mean`. Such an index would be relevant as indicator of major day-to-day shifts in weather. e.g. one day overcast and only little difference ...This extension would enable e.g. `maximum` as an alternative reducer to the currently hardcoded `mean`. Such an index would be relevant as indicator of major day-to-day shifts in weather. e.g. one day overcast and only little difference between day and night temperatures, and the next day clear skies with a large difference between a warm daytime temperatures and cool nighttime temperatures.
Cf. [clix-meta #89](https://github.com/clix-meta/clix-meta/issues/89)https://git.smhi.se/climix/climix/-/issues/295Amend index function `count_percentile_occurrences` to produce output either ...2023-04-27T06:45:46ZLars BärringAmend index function `count_percentile_occurrences` to produce output either in days or percentCLIX-META issue [#62](https://github.com/clix-meta/clix-meta/issues/62) points out that there is an inconsistency in definitions of various percentile-based temperature indices between ETCCDI and and ECA&D.
To account for this inconsis...CLIX-META issue [#62](https://github.com/clix-meta/clix-meta/issues/62) points out that there is an inconsistency in definitions of various percentile-based temperature indices between ETCCDI and and ECA&D.
To account for this inconsistency the CLIMIX index function `count_percentile_occurrences` should be able to produce results expressed either as % of calculation period (year, month, or any other), or as days according to what is provided from CLIX-META. As neither standard name nor cell method is currently available there is no complications regarding units or otherwise in that respect.
In the CLIX-META issue it is suggested that the decision on output unit could be defined by the user. Whether this should also be possible in CLIMIX should be handled in a different issue.https://git.smhi.se/climix/climix/-/issues/293Allow index functions to use coordinate information2023-02-13T15:18:49ZLars BärringAllow index functions to use coordinate informationSome indices need to include coordinate information in the calculation. Examples are:
* growing season length (`gsl`) and related indices that use latitude information to shift calculation period 6 month in the southern hemisphere
* suns...Some indices need to include coordinate information in the calculation. Examples are:
* growing season length (`gsl`) and related indices that use latitude information to shift calculation period 6 month in the southern hemisphere
* sunshine duration (`SSp`) that calculates the actual sunshine duration as a fraction of the day length (latitude, time)https://git.smhi.se/climix/climix/-/issues/292Add linting test stage using GitLab CI /Kubernetes2024-02-02T12:06:13ZJoakim LöwAdd linting test stage using GitLab CI /KubernetesFirst step utilizing Kubernetes for CI: add a linting test stage to run linting on a MR.First step utilizing Kubernetes for CI: add a linting test stage to run linting on a MR.Joakim LöwJoakim Löwhttps://git.smhi.se/climix/climix/-/issues/288SMHI start of seasons2024-02-02T12:08:17ZLars BärringSMHI start of seasonsImplement indicators (indices) for SMHI definitions of [start of] seasons. Possibly this can be done using existing functionality (`gsstart`?) and only new entries in the yaml file.
First step is to find out exactly how the season trans...Implement indicators (indices) for SMHI definitions of [start of] seasons. Possibly this can be done using existing functionality (`gsstart`?) and only new entries in the yaml file.
First step is to find out exactly how the season transitions are defined.0.22Gustav StrandbergGustav Strandberghttps://git.smhi.se/climix/climix/-/issues/286Index function for CW, CD, WW, WD2023-02-27T20:14:19ZLars BärringIndex function for CW, CD, WW, WDECA&D defines these two-variable indices as:
| VarName | OUTPUT_long_name |
|---------|---------------------------------------...ECA&D defines these two-variable indices as:
| VarName | OUTPUT_long_name |
|---------|--------------------------------------------------------------------------------------------------------------------------------|
| CD | Days with TG < 25th percentile of daily mean temperature and RR < 25th percentile of daily precipitation sum ("cold/dry days") |
| CW | Days with TG < 25th percentile of daily mean temperature and RR > 75th percentile of daily precipitation sum ("cold/wet days") |
| WD | Days with TG > 75th percentile of daily mean temperature and RR < 25th percentile of daily precipitation sum ("warm/dry days") |
| WW | Days with TG > 75th percentile of daily mean temperature and RR > 75th percentile of daily precipitation sum ("warm/wet days") |
where TG is "air **T**emperature near the **G**round ", i.e. the usual daily mean temperature `tas`, and RR is daily total precipitation `pr`.https://git.smhi.se/climix/climix/-/issues/285Implementation of index function for WSDI, CSDI2023-10-26T13:13:52ZLars BärringImplementation of index function for WSDI, CSDIWSDI and CSDI are (briefly) defined by ETCCDI and ET-SCI as
|VarName | OUTPUT_long_name |
|----------|------------------------------...WSDI and CSDI are (briefly) defined by ETCCDI and ET-SCI as
|VarName | OUTPUT_long_name |
|----------|-----------------------------------------------------------------------------------------------------------------------|
| wsdi | Warm Spell Duration Index, count of days with at least 6 consecutive days when Tmax > 90th percentile |
| wsdi{ND} | User-defined Warm Spell Duration Index, count of days with at least {ND} consecutive days when Tmax > 90th percentile |
| csdi | Cold Spell Duration Index, count of days with at least 6 consecutive days when Tmin < 10th percentile |
| csdi{ND} | User-defined Cold Spell Duration Index, count of days with at least # consecutive days when Tmin < 10th percentile |https://git.smhi.se/climix/climix/-/issues/281Climix API2023-06-09T14:05:16ZCarolina NilssonClimix APISome users use the functions in Climix and their own scripts which can be problematic in some cases. We need to take a decision on how one should use Climix, i.e. if we should limit and test the functions and create some sort of Climix API.Some users use the functions in Climix and their own scripts which can be problematic in some cases. We need to take a decision on how one should use Climix, i.e. if we should limit and test the functions and create some sort of Climix API.