NCAR / ADF

A unified collection of python scripts used to generate standard plots from CAM outputs.
Creative Commons Attribution 4.0 International
36 stars 29 forks source link

timeseries creation adds incorrect cell_method = mean attribute to fields #222

Closed bitterbark closed 1 year ago

bitterbark commented 1 year ago

ADF run type

Model vs. Model

What happened?

I have history files without cell_method = mean, but when I create timeseries files with ADF, they gain that attribute.

ADF Hash you are using

52cbe23

What machine were you running the ADF on?

CISL machine

What python environment were you using?

NPL (CISL machines only)

Extra info

History files in /glade/p/cgd/amp/bundy/archive/bhist.e213cosp217.f09_g17.mdtf_v3.2009/atm/hist

First file has mean in the var attributes, second doesn't:

ncdump -h bhist.e213cosp217.f09_g17.mdtf_v3.2009.cam.h3.2009-01-01-21600.nc | grep PRECC float PRECC(time, lat, lon) ; PRECC:units = "m/s" ; PRECC:long_name = "Convective precipitation rate (liq + ice)" ; PRECC:cell_methods = "time: mean" ;

ncdump -h bhist.e213cosp217.f09_g17.mdtf_v3.2009.cam.h2.2009-01-01-21600.nc | grep PRECC float PRECC(time, lat, lon) ; PRECC:units = "m/s" ; PRECC:long_name = "Convective precipitation rate (liq + ice)" ;

But resulting ts files have it in both:

set dir = /glade/campaign/cgd/amp/bundy/mdtf/cesm_mdtfv3_timeslice_orig/bhist.e213cosp217.f09_g17.mdtf_v3.2009/atm/ts /glade/u/home/bundy/diag/ADF_top/ADF> ncdump -h $dir /bhist.e213cosp217.f09_g17.mdtf_v3.2009.h2.PRECC.2009010121600-2013010121600.nc | grep cell time:cell_methods = "time: mean" ; time_bnds:cell_methods = "time: mean" ; PRECC:cell_methods = "time: mean" ; /glade/u/home/bundy/diag/ADF_top/ADF> ncdump -h $dir /bhist.e213cosp217.f09_g17.mdtf_v3.2009.h3.PRECC.2009010121600-2013010121600.nc | grep cell time:cell_methods = "time: mean" ; time_bnds:cell_methods = "time: mean" ; PRECC:cell_methods = "time: mean" ;

bitterbark commented 1 year ago

This is from the installation of nco/4.9+ on cheyenne/casper. See test results in /glade/p/cgd/amp/bundy/ncrcat_debug We can get around it by using module load nco/4.7.9, but I don't know how this is possible with the npl environment.

bitterbark commented 1 year ago

We can also get around it by using CGD machines!

bitterbark commented 1 year ago

Leaving this open until we get a fix from CISL. Meanwhile, to get around the bug using ADF, do these in order:

conda activate npl module load nco/4.9.5

You can check by calling

ncrcat --version NCO netCDF Operators version 4.9.5 "RBG" built by csgteam on casper01 at Oct 13 2020 00:02:03 ncrcat version 4.9.5

I haven't checked if this messes up anything else in the ADF, though; presumably we aren't using any fancy features in later versions of the NCOs...

@judithberner @WillyChap

bitterbark commented 1 year ago

Bug report produced quick results:

Thank you for reporting this bug. I just fixed it in the current snapshot that will become NCO 5.1.5 eventually. Until then your user can work around the issue by adding the --no_cll_mth switch to their ncrcat invocations.

Adding the --no_cll_mth switch to ADF's netcdf calls is a solution for us because it doesn't appear to remove existing cell_method attributes (which the native history files from the novel use to indicate averaging, etc) but it doesn't add it either. I will work on that and close this when I make the PR.