Closed RondeauG closed 6 months ago
I'd also note that the mere import of clisops.core
does not mean the user will perform any regridding. Would it be possible to delay the folder creation to the first time it is necessary ?
Thank you for reporting this issues.
I think one could use the tempfile
module. The name of the directory should however be persistent. The initialisation could be moved to Weights.__init__
.
@cehbrecht For rook you could specify a path under /home
in roocs.ini
so the cache persists.
@Zeitsperre I see you self assigned this. If you do not find the time, however, I will look at it next week.
@sol1105
Thanks for following up. My idea was to leverage platformdirs to use an OS-dependent fixed location by default (perhaps user_config_dir
or user_cache_dir
) in order to have a persistent location that can be wiped if needed.
Here's one way to implement it: https://github.com/Ouranosinc/xclim/blob/080e0b227fa6ca886691035d19f66355d9911219/xclim/testing/utils.py#L59 (Perhaps we could even do the same for the test data fetching here?)
@Zeitsperre Yes, that sounds good :) Generally using a persistent directory makes sense
Closed via #323
Description
When importing
clisops.core
,clisops.core.regrid.weights_cache_init()
is called, with the goal to create a temporary folder where weights would be stored.However, the default path specified in
roocs.ini
(/tmp/clisops_grid_weights
) is very Linux-centric and can provoke aPermissionError
in some Windows setups, since it tries to create a new folder underC:\tmp\clisops_grid_weights
.Using a platform-independent temporary folder would be preferable.