MPAS-Analysis
MPAS-Analysis copied to clipboard
Workaround needed for bug in conservationCheck analysis member
When I run the conservation analysis task, I'm seeing the bug reported in: https://github.com/E3SM-Project/E3SM/issues/6327 It manifests as:
Open conservation file /lcrc/group/e3sm/ac.xylar/analysis/20240328.GMPAS-JRA1p5-DIB-PISMF-TMIX.TL319_IcoswISC30E3r5.chrysalis/yrs-01-10/timeseries/oceanConservation.nc...
analysis task oceanConservation failed during run
Traceback (most recent call last):
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/analysis_task.py", line 322, in run
self.run_task()
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/ocean/conservation.py", line 232, in run_task
self._make_plot(plot_type)
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/ocean/conservation.py", line 332, in _make_plot
ds = open_mpas_dataset(fileName=self.outputFile,
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/io/mpas_reader.py", line 74, in open_mpas_dataset
ds = _parse_dataset_time(ds, timeVariableNames, calendar)
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/io/mpas_reader.py", line 197, in _parse_dataset_time
days = string_to_days_since_date(dateString=timeStrings,
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/timekeeping/utility.py", line 221, in string_to_days_since_date
dates = [string_to_datetime(string) for string in dateString]
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/timekeeping/utility.py", line 221, in <listcomp>
dates = [string_to_datetime(string) for string in dateString]
File "/lcrc/soft/climate/e3sm-unified/base/envs/e3sm_unified_1.9.3_chrysalis/lib/python3.10/site-packages/mpas_analysis/shared/timekeeping/utility.py", line 111, in string_to_datetime
return datetime.datetime(year=year, month=month, day=day, hour=hour,
ValueError: year 0 is out of range
My suggested fix would be just to load the whole dataset when we perform plotting, rather than a selected date range. The date range should already have been limited to the desired range in the call to ncrcat
.
Hmm, I see now that that's not a good fix because the analysis is written to work when comparing analysis that was run over two different periods of time, and to only plot the overlap of the first with the second. Maybe we really need to fix this in E3SM instead of try to work around it here.