Improve CST_SaveExp
Hi @aho,
I have changed a bit the function CST_SaveExp in the branch develop-SaveCube. Some improvements were needed regarding adding 'global_attrs' and saving correctly 'time_bounds'. However, there are other changes regarding the code that I'll explain briefly below.
I have created a file with some examples that I have used to tests the developments: UseCase4_CST_SaveExp. They are the tests I mention below.
New development
- Now the saving is done by ArrayToNc. Before, the library ncdf4 was used.
- Added development for allowing to save arrays with Dates that only have either 'ftime_dim' or 'sdate_dim' (you can see tests 1.4 and 4).
- Added parameter
units_hours_since
: description here. Optional, only used when single_file is TRUE due to having multiple time dimensions in the same file. You can see Tests 4. - Added parameter
global_attrs
: description here. You can see tests 1.6. - Allow saving 'time_bnds'. You can see Test 4.
- Reorganized the initial checks and improved unit test.
- Improved documentation.
When it does not work
- The function can save data from Start and then it is readable by Start. Also the function saves data from Load and it's readable by Start. However, I couldn't manage to read the saved data from Load with Load (see Test 5).
Testing
I think that it would be good if you can take a look on the tests I have checked. Since there are infinite possibilities, the most important things to test are the ones regarding time values:
- The development regarding 'time_bounds' (some examples are in these lines).
- The time units need to be checked carefully for both cases: single_file = TRUE and single_file = FALSE.
Could you test the development? If @vagudets you think you can test first the development regarding 'time bounds' (only if you have time) and then @aho can take a final look it would be great. However, any other way is fine.
Best,
Eva