Add script split multifield ncs#3
Conversation
…options. Also ran ruff formatter
…coder since it's doesn't seem necessary in analysis3
blimlim
left a comment
There was a problem hiding this comment.
Thanks @joshuatorrance, this is looking great and very thorough.
I've compared the outputs against um2nc single variable(?) outputs from the 89-single-variable-files branch, using a monthly esm1.6 file.
Overall using nccmp, there are almost no differences. Aside from the ones mentioned in the comments, there are differences in the time units formatting:
DIFFER : LENGTHS : ATTRIBUTE : units : VARIABLE : time : 21 <> 27 : VALUES : "days since 0001-01-01" : "days since 0001-01-01 00:00"
(I couldn't figure out how to configure this with xarray, or if it's possible)
and for some unknown reason, latitude_longitude is given a coordinates attribute with splitnc and not um2nc:
DIFFER : VARIABLE "latitude_longitude" IS MISSING ATTRIBUTE WITH NAME "coordinates" IN FILE "um2nc_split/atmosphere/fld_s03i257_aiihca.pa-000101_1mon.nc"
DIFFER : NUMBER OF ATTRIBUTES : VARIABLE : latitude_longitude : 4 <> 3
(this seems pretty minor though)
I'll check with the daily, 3hrly etc atmosphere outputs and also test it out with some ice outputs.
I've added a few small comments of things I noticed but nothing major.
…est now checks file count
Co-authored-by: Spencer Wong <88933912+blimlim@users.noreply.github.com>
…coords. Added ToDos
…, renaming bounds now uses recursion
blimlim
left a comment
There was a problem hiding this comment.
I've compared the outputs with the latest code to um2nc with single variable/field/... files, using the monthly, daily, 6hrly, 3hrly, and 1hrly outputs from an ESM1.6 run.
According to nccmp, all the files match up to the formatting for the time units, and occasional coordinate attribute which gets added to latitude_longitude. I don't think either of these are too concerning.
I'll test out a sea ice file now!
|
I can't see any issues in daily and monthly sea ice files produced by >>> ice_mon = xr.load_dataset("/g/data/tm70/sw6175/development/esm1p6/test_splitnc/ice_mon/iceh-1monthly-mean_0376-01.nc")
>>> ice_mon_split = xr.open_mfdataset("/g/data/tm70/sw6175/development/esm1p6/test_splitnc/ice_mon/output/*1monthly-mean*.nc", compat="identical")
>>> ice_day = xr.load_dataset("/g/data/tm70/sw6175/development/esm1p6/test_splitnc/ice_mon/iceh-1daily-mean_0376-01.nc")
>> ice_day_split = xr.open_mfdataset("/g/data/tm70/sw6175/development/esm1p6/test_splitnc/ice_mon/output/*1daily-mean*.nc", compat="identical")
>>> ice_day_split.compute().identical(ice_day)
True
>>> ice_mon_split.compute().identical(ice_mon)
True@anton-seaice I have some ESM1.6 CICE output split into single variable files using the script in this PR in |
aidanheerdegen
left a comment
There was a problem hiding this comment.
I've pushed submit on the feedback so far in case I don't get back to it in a timely fashion.
I have not reviewed the main logic as yet, but don't let me hold you up.
blimlim
left a comment
There was a problem hiding this comment.
Thanks @joshuatorrance, this is looking good on my end. Just noticed one small thing on a final read through
blimlim
left a comment
There was a problem hiding this comment.
Thanks @joshuatorrance for putting this together, everything's looking good to me!
|
How is this getting deployed? just in |
|
I think there should be something in global attributes about what operation was done to make the file, having the existing metadata is good: but an extra attribute linking to the code used for post processing would be good |
|
Is the goal to exactly follow the ocean filename convention?
should be
right ? |
|
This looks great @joshuatorrance - thanks for all your work on this |
Yup, the current naming scheme is just a place holder. We're intending to mimic the ocean filename patterns. Exactly how that gets wired up is the next challenge - it's likely it'll require more updates to this script ( #4 ) |
Oooh good point! |
Co-authored-by: Spencer Wong <88933912+blimlim@users.noreply.github.com>
blimlim
left a comment
There was a problem hiding this comment.
Thanks @joshuatorrance, this looks great!
blimlim
left a comment
There was a problem hiding this comment.
Thanks @joshuatorrance!
This script splits multi-field netCDF files produced for ESM1.6 into single-field files.
It is intended to be used on ESM1.6 atmosphere and ice output.