generate_time_averages

I think this is in a "usable enough" state to begin reviewing. There's some fluff in here I need to trim, some mess to tidy up, etc... but the major parts are in place. Here's the rundown of the big pieces:

1. conda environment changes/README

First I needed to understand the environment requirements for running my module, so i set about including the required packages in the environment.yaml/re-building/re-testing. After a few cycles of this I ran into some issues running tests I defined for generate_time_averages and not seeing changes I made to my module reflected in the results.

I realized pytest was using a cached, old version of my module in my .local folder, which is generally touched by pip install. I was able to figure out that after conda env create --file environment.yml, the pip install . step is redundant if one includes all the necessary packages in the conda recipe. By avoiding that step, .local doesn't get any cached copies of fre_python_tools modules, and we can avoid module-import confusion in the conda recipe.

I edited the miniconda recipe in the README accordingly. Note that this changes the way we should call pytest, and we should do so as a module, like python -m pytest tests/ from the root directory (fre-python-tools).

2. fre_python_tools/generate_time_averages, the module itself, of course

There's a few different functions here. generate_cdo_timavg is the focus, and the most flexible. generate_nco_timavg does not work and will be removed. generate_frenctools_timavg does work in theory, but without a conda recipe in a specific channel, cannot be used in a portable manner (though i hear this is in the works). generate_frepythontools_timavg only does a full average of a variable, i.e. using all time points available in the targeted netcdf file, and is very inflexible, though it's at least actually a python-native routine.

3. corresponding tests for generate_time_averages

I have some bash scripts that generate-time-averaged output via CLI tools to compare to, and that is their only purpose. There's some basic testing to check for the existence of that output, check for the directory containing files for inputs, check that the pytest call is from the correct directory, and that generate_cdo_timavg creates files when asked to do so.

Merge request reports

Loading