-
Notifications
You must be signed in to change notification settings - Fork 32
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
CDAT migration: Fix African easterly wave density plots in TC analysis and convert H20LNZ units to ppm/volume #882
Conversation
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.
Hey @chengzhuzhang this PR is ready for review. I've performed a self-review, but good to make sure the changes align with your two PRs mentioned in this PR's description.
Summary of changes
tc_analysis_driver.py
- Remove
lat
/lon
slice - Add function
_filter_lines_within_year_bounds()
to remove excessive time points crossing year bounds for 6 hourly data
- Remove
zonal_mean_2d_driver.py
- Update
_convert_g_kg_to_ppm_units()
to convert to ppm by volume.
- Update
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.
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.
Changes should align with https://github.com/E3SM-Project/e3sm_diags/pull/851/files
Note, #872 was already addressed on this branch.
def _filter_lines_within_year_bounds( | ||
lines_orig: List[str], data_end_year: int | ||
) -> List[str]: | ||
"""Filters lines within the specified year bounds. | ||
|
||
This function processes a list of strings, each representing a line of data. | ||
It filters out lines based on a year extracted from each line, ensuring that | ||
only lines with years less than or equal to `data_end_year` are retained. | ||
Additionally, it removes excessive time points crossing year bounds from | ||
6-hourly data. | ||
|
||
Parameters | ||
---------- | ||
lines_orig : List[str] | ||
A list of strings where each string represents a line of data. | ||
data_end_year : int | ||
The end year for filtering lines. Only lines with years less than or | ||
equal to this value will be retained. | ||
Returns | ||
------- | ||
List[str] | ||
A list of strings filtered based on the specified year bounds. | ||
""" | ||
line_ind = [] | ||
for i in range(0, np.size(lines_orig)): | ||
if lines_orig[i][0] == "s": | ||
year = int(lines_orig[i].split("\t")[2]) | ||
|
||
if year <= data_end_year: | ||
line_ind.append(i) | ||
|
||
end_ind = line_ind[-1] | ||
|
||
new_lines = lines_orig[0:end_ind] | ||
return new_lines |
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.
FYI I used GitHub Co-Pilot to extract this function and generated the docstring. I've found it to be useful for these kinds of tasks.
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.
Nice finding!
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.
@tomvothecoder I think the changes in .cfg files for H2OLNZ units change are not brought in this PR: https://github.com/E3SM-Project/e3sm_diags/pull/874/files#diff-794c0344b0a718e616d2051d6961d02c79f24e8d5e97c7c355fa7cb0ec467e19
For that specific PR, the changes are already here. Example: e3sm_diags/e3sm_diags/driver/default_diags/zonal_mean_2d_stratosphere_model_vs_obs.cfg Lines 65 to 75 in 3df16d2
I rebased the dev branch on the latest |
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.
Looking good! The PR is good to go!
@tomvothecoder Just a heads-up that this PR is also just merged: #879 and we need to bring to migration branch.. |
…s and convert H20LNZ units to ppm/volume (#882)
Done |
Description
cdat-migration-fy24
but I refactored it a bit moremain
tocdat-migration-fy24
#871Checklist
If applicable: