Skip to content
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

Bug fix for the mean_climate and varibility_mode drivers #1132

Merged
merged 2 commits into from
Sep 21, 2024
Merged

Conversation

zhangshixuan1987
Copy link
Collaborator

Hi Jiwoo,

I submit this pull request to propose some solutions for the recent bug found in my run cases:

  1. the first small bug fix is related to the issue as I mentioned in [Bug]: wrong unit conversion in mean climate diagnostics  #1128, i.e. the unit conversion for pressure level data and its related calculation in mean climate driver

  2. the second small bug fix is to address the issue I mentioned in your e-mail, i.e. the analysis for the model simulations that started from year 0 such as piControl simulations. From my tests, the piControl simulation can be processed without issues by fixing the following two places:

  • add an explicit conversion of year to 4-digts in pcmdi_metrics/variability_mode/lib/lib_variability_mode.py, which is included in this pull request for the PCMDI package.

  • meanwhile, adjustments in the external library, i.e. XCDAT are also needed, you can see the bug report I submitted at [Bug]: Potential bug in temporal.py module xCDAT/xcdat#695

Please take a look and see if they provide useful hints for you to develop a better solution in the PCMDI package.

The driver contains the following code block:
    result_dict["Variable"] = dict()
    result_dict["Variable"]["id"] = varname
    if level is not None:
        result_dict["Variable"]["level"] = level * 100  # hPa to Pa

that attempts to convert the specified pressure level from hPa to Pa.
However, this code block conflicted with the following code block in
the associated libarary model "load_and_regrid.py":

if "plev" in list(ds.coords.keys()):
            if ds.plev.units == "Pa":
                level = level * 100  # hPa to Pa
            try:
                ds = ds.sel(plev=level)

The plev in reanalysis such as ERA5 has a unit of Pa by default. The
above two code blocks will lead to wrong level
and failure of the data selection.
@lee1043 lee1043 merged commit 2aa8d00 into main Sep 21, 2024
5 checks passed
@lee1043 lee1043 deleted the zhan391 branch September 21, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants