POD discussion: ENSO MSE (Moist Static Energy Budget) #117
Replies: 4 comments
-
Progress update: Link to development branch and POD commit history. These links will stop working when the branch is deleted after integration work is finished. Links to files below will remain valid. Current bugs/errors:
Remaining necessary tasks:
Edit: |
Beta Was this translation helpful? Give feedback.
-
More detail on the overflow bug (number 3) in #19 (comment) . Here's the relevant section of the logs: Log details
The overflow is due to the use of sentinel values (called since the same remarks apply to all of them. The data causing the overflow ( MDTF-diagnostics/diagnostics/ENSO_MSE/MSE_VAR/MSE_VAR.py Lines 153 to 157 in 33e9eaf Python floats are 64-bit (technically, the length of a double set in the float.h on the system where the interpreter was compiled). When evaluating ts[i,j] < undef , ts[i,j] is promoted to 64-bits. Even if ts[i,j] was set to the sentinel value, the comparison will never evaluate to False due to roundoff error, as the decimal value chosen for undef isn't exactly representable in binary. The entries of ts that were set equal to the sentinel value are not excluded from the sum, which overflows.
This can be confirmed via debugging statements added in the following commit: 33e9eaf . When missing data is encountered (eg, by running the POD on a date range without both El Nino and La Nina years), the first debug statement will be printed many times, while the second will never be printed. Recommended fix is to use NumPy best practices as listed on the MDTF documentation, in particular the use of NumPy MaskedArrays to handle missing or invalid data instead of comparisons to sentinel values. Furthermore, the covariance computations done by moisture_variance can be done quicker, using compiled code, by calling numpy.cov along with numpy.flatten, etc. rather than re-implementing these functions in the POD. |
Beta Was this translation helpful? Give feedback.
-
Current bugs/errors:
(i)We have removed the raw ERA-interim monthly data and that has reduced the size significantly. (ii) We have fixed the pre-digested observations (in our ERA-interim) results as follows: (a) COMPOSITES; (b) CLIMA: (c) MSE_terms; (d) MSE_var_terms Now there is NO need to process the observations every time the POD is run. We have kept the pre-processed results as before in the respective subdirectories. The script will just re-produce the plots 2 Assumptions on dimensions of model variables:
Response: Checks for variable units – with xarray – have been set up.
Response: Checks are implemented to inform users (interactively): Handling missing data with the data mask has been implemented, all missing data are masked now.
Response: Fixed 5 Scatterplots in stage 4 do not include data for the model being analyzed. No model data (either input data, or intermediate data generated by previous stages) is loaded by the code in this section. Response: We have fixed this. Results from the “model being analyzed” will be included with the pre-digested values to make the SCATTER. Remaining necessary tasks:
Response: All the bugs listed above are fixed.
Response: Regarding observational data policy size - This has been taken care of (see our response to issue # 1)
Response: Done (see above) More detail on the overflow bug (number 3) in #19 (comment) . (i) The problem is with use of if(ts[i,j] < undef): which in python is not handled the same way as in FORTRAN. Tom suggests to use “mask” on arrays instead of if statements : if( ts < undef): (ii) Furthermore, the covariance computations done by moisture_variance can be done quicker, using compiled code, by calling numpy.cov along with numpy.flatten, etc. rather than re-implementing these functions in the POD. Response: Implemented as recommended. B: Tom’s comments - his email Friday 28th August I have the following recommendations for improving the runtime (in descending order of priority):
Response: Done.
Response: Thanks
Response: The monthly files were merged into annual files as suggested for model data. We will no longer provide raw monthly data for ERA-interim. Additional issues we encountered. Took more time to identify the source of errors.
Response/Fix: This needed to debug “segment by segment” to find out exact line which gives the trouble. It turned out that the framework script is searching through all directories under ~/diagnostics, even if only one POD is requested (e.g. ENSO_MSE). It is searching for specific files, namely: settings.jsonc. In subdirectory ~/diagnostics/example this file was downloaded from the MDTF github depository, along with example_diag.py. I have downloaded those files incorrectly, and they came out as html files rather than ASCII. This discrepancy in format of settings.jsonc file caused the framework script to “hang up” with no error message output. Just removing the whole directory ~/diagnostics/example solved the problem.
Response/Fix: When I updated python code with new python modules (e.g. xarrays, netcdf4), those were not loaded during the run. When testing sample python code outside the framework, all modules loaded just fine. I have checked with conda if those modules are loaded under _MDTF_python3_base, which they were. All installed via: conda install -c conda-forge new_package. Also the new modules were updated in the ~/src/conda/env_ENSO_MSE.yml file. When checking system output messages, it showed that new modules are not loaded under _MDTF_ENSO_MSE environment, that is the environment ENSO_MSE POD is supposed to run. The solution was to re-run conda set up as follows: % cd $CODE_ROOT |
Beta Was this translation helpful? Give feedback.
-
The branch containing existing development work on this POD has been renamed from pod/ENSO_MSE to feature/add_ENSO_MSE, as part of the reorganization proposed in issue #106. |
Beta Was this translation helpful? Give feedback.
-
Thread for progress in adding ENSO_MSE diagnostic from Hariharasubramanian Annamalai (U. Hawaii).
Legacy documentation:
http://www.cgd.ucar.edu/cms/bundy/Projects/diagnostics/mdtf/mdtf_figures/MDTF_CCSM4/MSE_diag/MSE_diag.html
Beta Was this translation helpful? Give feedback.
All reactions