pacificclimate / climate-explorer-data-prep

0 stars 0 forks source link

Fixed bug #132. split_intervals passed into create_climo_files #133

Closed sum1lim closed 4 years ago

sum1lim commented 4 years ago

This PR closes #132

As mentioned in the issue, the input option split_intervals exists but never passed into create_climo_files. Therefore, split_variable was always set to default value "True", which makes the same output files no matter what value was given to the option:

(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ generate_climos -o output_without_split_intervals ./tests/data/tiny_daily_pr.nc -p mean

...

(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ ls output_without_split_intervals
pr_aClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ generate_climos -o output_no_argument_passing -i False ./tests/data/tiny_daily_pr.nc -p mean

...

(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ ls output_no_argument_passing
pr_aClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_aClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_mClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_sClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc

After modifying the code to pass the argument into create_climo_files, these are the output files I am getting:

(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ generate_climos -o output_argument_passing -i False ./tests/data/tiny_daily_pr.nc -p mean

...

(venv) slim@devel2:~/Desktop/climate-explorer-data-prep$ ls output_argument_passing
pr_msaClimMean_CanESM2_historical_r1i1p1_19610101-19901231.nc
pr_msaClimMean_CanESM2_historical_r1i1p1_19710101-20001231.nc
pr_msaClimMean_CanESM2_historical_r1i1p1_19810101-20101231.nc
pr_msaClimMean_CanESM2_historical_r1i1p1_20100101-20391231.nc
pr_msaClimMean_CanESM2_historical_r1i1p1_20400101-20691231.nc
pr_msaClimMean_CanESM2_historical_r1i1p1_20700101-20991231.nc
sum1lim commented 4 years ago

This PR required a lot more modifications than expected. Therefore, I would like to ask @nikola-rados to have a look since wps_generate_climos is implemented in thunderbird repo.