-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic plotting for global time series #400
Conversation
Committed with
|
frequency = "monthly" | ||
input_files = "eam.h0" | ||
input_subdir = "archive/atm/hist" | ||
mapping_file = "glb" | ||
vars = "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,TAUX,TAUY,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT,CLDTOT,CLDHGH,CLDMED,CLDLOW,U,CO2,CO2_FFF,CO2_OCN,CO2_LND,TMCO2,TMCO2_FFF,TMCO2_LND,TMCO2_OCN,TOTSOMC,TOTECOSYSC,NEE,TOTVEGC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra variables cause the following errors for the atm_monthly_glb
subtask of ts
:
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TMCO2_LND' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TOTSOMC' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'CO2' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'CO2_OCN' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TMCO2' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TOTECOSYSC' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TMCO2_FFF' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TMCO2_OCN' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'CO2_LND' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'TOTVEGC' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'CO2_FFF' is not in and/or does not match contents of input file
ncrcat: ERROR nco_xtr_mk() reports user-supplied variable name or regular expression 'NEE' is not in and/or does not match contents of input file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variables I believe are specialized BGC/HES output, the error is expected if the variables are not included in the test datasets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @BunnyVon could provide some datasets for testing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly. I have the CBGCv2 spin-up and production runs on chrysalis:
production run: /lcrc/group/e3sm/ac.sfeng1/E3SM_Simulations/20221127.v2.LR.BGC-LNDATM.CONTRL.ne30pg2_r05_EC30to60E2r2.chrysalis' spinup run:
/lcrc/group/e3sm/ac.sfeng1/E3SM_Simulations/20221219.CBGCv1.LR.BGC-LNDATM.20TR.ne30_oECv3.chrysalis'
The relevant zppy configuration files are in /home/ac.sfeng/zppy
zppy/templates/coupled_global.py
Outdated
try: | ||
plot_generic(ax, xlim, exps, extra_plots[counter_extra_plots]) | ||
except: | ||
print(f"Invalid var={extra_plots[counter_extra_plots]}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I tried running without adding the variables to ts
above (which also had issues, see above comment).
That causes the following plots to not generate:
Invalid var=CO2
Invalid var=CO2_FFF
Invalid var=CO2_OCN
Invalid var=CO2_LND
Invalid var=TMCO2
Invalid var=TMCO2_FFF
Invalid var=TMCO2_LND
Invalid var=TMCO2_OCN
Invalid var=TOTSOMC
Invalid var=TOTECOSYSC
Invalid var=NEE
Invalid var=TOTVEGC
zppy/templates/coupled_global.py
Outdated
"var": lambda exp: np.array(exp["annual"][var_name]), | ||
"verbose": False, | ||
"vol": False, | ||
"ylabel": "???", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No way to know the units unless we were to have users pass in tuples of (var_name, ylabel)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be possible to extract the units once we get the variable from the v = ts.globalAnnual(var)
line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The var_name and units should preserve in cdms2's TransientVariable (in current implementation) or xarry's DataArray (after migrating to xarray). I suspect that the units were stripped of in readTS.py, and it should possible to get it back, i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my latest commit 5fd2055 appears to allow units to be deduced automatically.
42d2452
to
5fd2055
Compare
Latest analysis of variables (code not pushed yet). I need to further investigate these failures. From
The output file also includes the following failures:
The last 12 appear to fail because of |
I rebased off the latest
Note that the extra plots we're adding are:
I will debug further. |
@forsyth2 , for those variables that can't be plotted. Those variables that have filenames including "CO2" are 3D variables. My experience was that zppy had a hard time handling 3D variables back then, not sure if that's still the case. as for those with "TOT", they are elm variables. do they need to be handled separately from eam variables? |
I tried adding the variables to the
Are these variables just not available in the simulation I'm using as input?? |
I think |
@BunnyVon Possibly? I'm wondering if "does not match contents of input file" indicates a difference in dimension as you suggest. Unfortunately, that error message isn't terribly informative. I do see a block to specifically remove Lines 62 to 70 in 4db3e24
@chengzhuzhang @czender Do either of you have any thoughts here? My two guesses at this point are 1) @BunnyVon's suggestion of a dimension mismatch and 2) the variable data wasn't saved for the input I'm using (a v2 water cycle run -- see |
I do remember removing |
I agree with your assessment here. For now, we perhaps should limit to applying ts_global to 2d variables. And many BGC land variables don't exist in the v2 water cycle run. For testing purpose, I think you could try those 2d variables available from the elm.h0 from the v2.historical run that you have been using.. |
Hmm I tried running the
|
The derivations are as follows:
@chengzhuzhang @BunnyVon I don't think any of the variables we want extra plots of will work with this input... Is there a simulation done by the land team I should use as input instead?? Thanks. |
ah, I see the problem now. WC v2 didn't have active BGC. those TOT variables only exist in emission-driven with active BGC runs. @forsyth2 , you can use my output https://acme-climate.atlassian.net/wiki/spaces/EBGC/pages/3578691870/20221127.v2.LR.BGC-LNDATM.CONTROL.ne30pg2+r05+EC30to60E2r2.chrysalis you won't have |
Ah this was causing an issue as I hadn't removed all the I was getting
|
I was still running into issues and after running
I changed that to:
But I'm still running into errors.
So I'm not exactly sure why it's not picking up that the input files are, in fact, present. |
@forsyth2 It looks to me like there is a mistake in the use of quotes and wildcards and stdout redirection in the above tests. The first line
One problem is that the single quotes turn the asterisk from a wildcard character into a string literal. So no matching is performed. The other problem is that there is no greater-than sign to redirect the output of
|
Yes, I thought that was odd too. I don't know why
The line you're referring to here is the output of the |
@forsyth2 I saw |
@forsyth2 Please LMK if there are any unresolved questions regarding observed vs documented behavior of NCO's |
7238d69
to
c3515cd
Compare
@chengzhuzhang @xylar After reviewing some comments earlier on this PR, I wrote a summary on how to test newer package versions in |
@chengzhuzhang Thanks for the |
@forsyth2 It appears to be a slight difference in time axis of the land global averaged file resulted the error of unmatching years. The first time bounds of the land file is time_bounds = [-0.0208333333333333, 31] (while it is [0,31] for atmopshere files), and I suspect the yearly averaging routine (v = cdutil.YEAR(v)) compute average, based on weights computed from time_bounds. I think it got confused with the negative value and produce one excessive yearly mean. With the latest commit, I'm able to create the land plots. Though it would be good to test if there is any regression for the original plots. This time_bounds issue is perhaps only occur with the first year of piControl run. I think it perhaps is worthwhile to inform @czender about this time_bounds problem. |
Thanks @chengzhuzhang! I'll test and then get the commits sorted out. |
@chengzhuzhang Ok I was able to generate the plots using your one-line fix. I was also able to run Expansion of table from #400 (comment) and #400 (comment):
It now occurs to me that this one-line fix is exactly what I removed because we decided it wasn't necessary when using NCO 5.2.3. Summary of behavior:
|
@chengzhuzhang Is it possible the values using |
I can confirm that using I also confirmed that the time bounds induced error |
@chengzhuzhang ok great, thanks! I'll clean up the PR and merge. And also file an issue for that case. |
I condensed the commits and left a second commit for removing the relevant testing files (they shouldn't go into |
I created #571 |
Thanks to everyone on the PR for the help in getting this to completion! I'm planning to release a zppy RC including this feature this week. |
Thank you @forsyth2 ! Do you have a template or an instruction for me to test and analyze my output? My land-atm BGC coupled historical run is just complete. |
@BunnyVon Thanks! Probably a variation of my
|
@forsyth2 , I ran into an error
|
@BunnyVon Your Luckily though, Unified 1.10.0rc1 was just released today and that has the latest NCO, so you can simply set |
Nice! it does help. Thank you @forsyth2 . However, another error showed up. This error is related to a variable
|
@BunnyVon Remove |
ah, thanks for the link. it makes a lot of sense now. I will modify it for my production run. Thank you again @forsyth2 |
@BunnyVon glad to know that you are testing this new feature with your production run. I'm working on hand over a zppy configuration to coupled team. Let me know if there is a good variable list I should follow for the global time series plots for land. Thanks! |
Generic plotting for global time series. One option from #399. Resolves #399. Also resolves #562. Also resolves #569.