pcmdi_metrics
pcmdi_metrics copied to clipboard
New monsoon sperber code in xCDAT -- PR cleaned up
This PR is for monsoon_sperber code that is converted to use xcdat (update by @bosup). A new branch is made by @lee1043 for clean up the previous PR (#1011).
@bosup I found the difference in the output. Can you investigate where that is coming from and if they could be more consistent?
Metrics calculated from the previous version of the code (shown from Demo_2b_notebook):
{
"GISS-E2-H": {
"r1i1p1": {
"AIR": {
"decay_index": 53,
"duration": 17,
"onset_index": 37,
"slope": 0.037490989405760906
},
"AUS": {
"decay_index": 52,
"duration": 22,
"onset_index": 31,
"slope": 0.028602770104420926
},
"GoG": {
"decay_index": 49,
"duration": 24,
"onset_index": 26,
"slope": 0.017398272573029495
},
"NAmo": {
"decay_index": 64,
"duration": 52,
"onset_index": 13,
"slope": 0.012011903431421198
},
"SAmo": {
"decay_index": 56,
"duration": 30,
"onset_index": 27,
"slope": 0.020883715095941786
},
"Sahel": {
"decay_index": 47,
"duration": 17,
"onset_index": 31,
"slope": 0.03490883309967567
}
}
}
}
Metrics calculated from the code in this PR:
{
"GISS-E2-H": {
"r1i1p1": {
"AIR": {
"decay_index": 54,
"duration": 20,
"onset_index": 35,
"slope": 0.032632458420097696
},
"AUS": {
"decay_index": 54,
"duration": 23,
"onset_index": 32,
"slope": 0.0272846353443767
},
"GoG": {
"decay_index": 48,
"duration": 23,
"onset_index": 26,
"slope": 0.01760572910784664
},
"NAmo": {
"decay_index": 63,
"duration": 51,
"onset_index": 13,
"slope": 0.011989028721760442
},
"SAmo": {
"decay_index": 56,
"duration": 31,
"onset_index": 26,
"slope": 0.020573642677988356
},
"Sahel": {
"decay_index": 48,
"duration": 18,
"onset_index": 31,
"slope": 0.03399930925007501
}
}
}
}
@bosup informed that this PR is ready for review (thanks!). @lee1043 will start reviewing it.
@bosup has been working on this PR. Below is for the verification result. monsoon_Sperber_code_conversion_comparison.pdf
metrics result comparison for xcdat and cdms by monsoon regions: Xcdat and cdms result comparison by regions.pdf
metrics result comparison for xcdat and cdms by monsoon regions: Xcdat and cdms result comparison by regions.pdf
@bosup Thanks for updating the plot. I see 9 models were tested, and it might be more robust to have more models included for testing. Would it be possible to include more of CMIP5 models for this test?
scatter plots for comparison of monsoon onset index between cdms and xcdat-converted code.
metrics result comparison for xcdat and cdms by monsoon regions: Xcdat and cdms result comparison by regions.pdf
@bosup Thanks for updating the plot. I see 9 models were tested, and it might be more robust to have more models included for testing. Would it be possible to include more of CMIP5 models for this test?
more CMIP5 models included.
Progress note: @lee1043 is taking this PR over to finalize it.
It looks like demo notebook 2b boxes [5] and [6] are failing. Debugging is going to be needed.
Error message:
modpath = <pcmdi_metrics.utils.string_constructor.StringConstructor object at 0x158d9ff10>
modpath_lf = <pcmdi_metrics.utils.string_constructor.StringConstructor object at 0x158d9feb0>
models: ['GISS-E2-H']
number of models: 1
realization: r1i1p1
demo_output/monsoon_sperber/Ex1
demo_output/monsoon_sperber/Ex1
demo_output/monsoon_sperber/Ex1
debug: False
==== model: obs ======================================
2024-05-14 22:59:34,588 [WARNING]: dataset.py(open_dataset:120) >> "No time coordinates were found in this dataset to decode. If time coordinates were expected to exist, make sure they are detectable by setting the CF 'axis' or 'standard_name' attribute (e.g., ds['time'].attrs['axis'] = 'T' or ds['time'].attrs['standard_name'] = 'time'). Afterwards, try decoding again with `xcdat.decode_time`."
2024-05-14 22:59:34,588 [WARNING]: dataset.py(open_dataset:120) >> "No time coordinates were found in this dataset to decode. If time coordinates were expected to exist, make sure they are detectable by setting the CF 'axis' or 'standard_name' attribute (e.g., ds['time'].attrs['axis'] = 'T' or ds['time'].attrs['standard_name'] = 'time'). Afterwards, try decoding again with `xcdat.decode_time`."
--- obs ---
model_path = demo_data/obs4MIPs_PCMDI_daily/NASA-JPL/GPCP-1-3/day/pr/gn/latest/pr_day_GPCP-1-3_PCMDI_gn_19961002-20170101.nc
warning: faild for obs obs 'NoneType' object is not iterable
==== model: GISS-E2-H ======================================
model_lf_path = demo_data/CMIP5_demo_data/cmip5.historical.GISS-E2-H.sftlf.nc
2024-05-14 22:59:35,970 [WARNING]: dataset.py(open_dataset:120) >> "No time coordinates were found in this dataset to decode. If time coordinates were expected to exist, make sure they are detectable by setting the CF 'axis' or 'standard_name' attribute (e.g., ds['time'].attrs['axis'] = 'T' or ds['time'].attrs['standard_name'] = 'time'). Afterwards, try decoding again with `xcdat.decode_time`."
2024-05-14 22:59:35,970 [WARNING]: dataset.py(open_dataset:120) >> "No time coordinates were found in this dataset to decode. If time coordinates were expected to exist, make sure they are detectable by setting the CF 'axis' or 'standard_name' attribute (e.g., ds['time'].attrs['axis'] = 'T' or ds['time'].attrs['standard_name'] = 'time'). Afterwards, try decoding again with `xcdat.decode_time`."
--- r1i1p1 ---
model_path = demo_data/CMIP5_demo_timeseries/historical/atmos/day/pr/pr_day_GISS-E2-H_historical_r6i1p1_20000101-20051231.nc
warning: faild for GISS-E2-H r1i1p1 'NoneType' object is not iterable
Progress note:
- The above-mentioned error is now resolved.
- Demo 2b notebook runs without error.
- Verification is going to be needed.
@acordonez I think this PR is pretty much ready. When you get a chance could you please run demo 2b with this PR to see if it runs well?
@lee1043 The notebook ran with no errors. I am seeing some slight differences in the metrics but is that also expected similar to the MJO? For example, decay index of 48 vs. 47, or slope of 0.03490883309967567 vs. 0.03399930924787022.
@acordonez thanks for reviewing and approving. Yes, although it would be nicer if we've got more consistency for the indices, it looks like further in depth investigation might be needed to fully address that, and I consider for now it is acceptable. I am going to merge this PR and tag v3.5.
All checks passed, merging it now.