-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add figure preprocessing scripts to precip variability metrics #1069
Conversation
Thanks for adding these scripts. Can you rename file names to use underscores instead of periods in the middle of file names? |
pcmdi_metrics/precip_variability/scripts_pcmdi/calc_ps_area_freq_mean_regional.py
Show resolved
Hide resolved
del psdmfm[frc][mip][dat][var][dom] | ||
psdmfm[frc][mip][dat][var][dom] = {} | ||
print(dom) | ||
for frq in frqs: |
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.
@msahn In this loop, lines 74-130, I would like to double-check that all the time scales are being correctly sliced. If you could review this section I would greatly appreciate it.
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.
For semi-annual and annual, I use np.amax
instead of np.nanmean
to select maximum power within their range as below. This is to handle CMIP models that have different periods for semi-annual and annual cycles because they use different calendars (e.g., 360-day, 365-day, and Gregorian).
pcmdi_metrics/pcmdi_metrics/precip_variability/lib/lib_variability_across_timescales.py
Lines 433 to 440 in 035f654
elif frq == "semi-annual": # 180day=<pr=<183day | |
idx2 = prdday_to_frqidx(180, frequency, ntd) | |
idx1 = prdday_to_frqidx(183, frequency, ntd) | |
amfm = np.amax(am[idx1 : idx2 + 1]) | |
elif frq == "annual": # 360day=<pr=<366day | |
idx2 = prdday_to_frqidx(360, frequency, ntd) | |
idx1 = prdday_to_frqidx(366, frequency, ntd) | |
amfm = np.amax(am[idx1 : idx2 + 1]) |
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.
@msahn Thank you for pointing this out! I have another question about the sub-daily timescale indices. If I'm interpreting this correctly, are we getting the average of data at frequencies equal to or larger than the sub-daily frequency?
amfm = np.nanmean(am[idx1 + 1 :])
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.
For the sub-daily timescale, we average frequencies larger than 1 day (pr<1day). The frequency of 1day is included in the synoptic timescale (1day=<pr<20day). This information is written as comments in the code.
pcmdi_metrics/pcmdi_metrics/precip_variability/lib/lib_variability_across_timescales.py
Line 441 in 035f654
elif frq == "sub-daily": # pr<1day |
Done |
Looks good to me! |
This PR add three scripts to pcmdi_metrics/precip_variability/scripts_pcmdi/. These scripts can be used to postprocess the netcdf outputs from the precip variability metrics into data to make Figure 6. This PR only includes the custom defined regional metrics case where each region is in a separate run. It does not address postprocessing for the default zonal average regions.
Scripts:
calc_ps_area.freq.mean.regional.py
calc_ps_area.mean.regional.py
calc_ps_freq.mean.regional.py