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

Regional capabilities for precip variability #980

Merged
merged 73 commits into from
Sep 24, 2024
Merged

Conversation

acordonez
Copy link
Collaborator

@acordonez acordonez commented Sep 12, 2023

  • Subset grid by latitude and longitude - CropLatLon function and parser updates
  • Add "standard" calendar checks
  • Update filenames for arbitrary grid size
  • Update RegridHoriz function for arbitrary lat/lon resolution
  • Update Avg_PS_DomFrq to add custom region option
  • Add option to crop dataset via shapefile
  • Check for any remaining cdat reference to remove
  • Clean up new code
  • Resolve conflicts
  • Document new features

@acordonez
Copy link
Collaborator Author

Ready to review but running into CI issues due to same issue documented here: #1103

@acordonez acordonez marked this pull request as ready for review August 1, 2024 21:10
@acordonez acordonez self-assigned this Aug 2, 2024
@lee1043
Copy link
Contributor

lee1043 commented Aug 23, 2024

@acordonez could you remind me an example commend to test this capability? Do we have a shape file example as a part of the demo download file?

@acordonez
Copy link
Collaborator Author

@acordonez could you remind me an example commend to test this capability? Do we have a shape file example as a part of the demo download file?

@lee1043 I am not aware of a shapefile in the demo file. I've been running this with an NCA5 regions shapefile that I can point you to on perlmutter for testing.

@lee1043
Copy link
Contributor

lee1043 commented Aug 26, 2024

@acordonez I am running Demo 7 notebook with this branch, and getting below error. Could this be related to the change in this PR?

Commend:

variability_across_timescales_PS_driver.py -p basic_precip_variability_param.py

Error message:

demo_data_tmp/CMIP5_demo_timeseries/historical/atmos/day/pr/
pr_day_GISS-E2-H_historical_r6i1p1_*.nc
[2000, 2005]
730 365
2
demo_output_tmp/precip_variability/GISS-E2-H/
demo_output_tmp/precip_variability/GISS-E2-H/
demo_output_tmp/precip_variability/GISS-E2-H/
['demo_data_tmp/CMIP5_demo_timeseries/historical/atmos/day/pr/pr_day_GISS-E2-H_historical_r6i1p1_20000101-20051231.nc']
GISS-E2-H.r6i1p1
['demo_data_tmp/CMIP5_demo_timeseries/historical/atmos/day/pr/pr_day_GISS-E2-H_historical_r6i1p1_20000101-20051231.nc']
GISS-E2-H.r6i1p1 365_day
syr, eyr: 2000 2005
Complete regridding from (2190, 90, 144) to (2190, 90, 180)
/home/lee1043/.conda/envs/pcmdi_metrics_dev_20240220/lib/python3.10/site-packages/pcmdi_metrics/precip_variability/lib/lib_variability_across_timescales.py:315: FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.
  climtime = pd.period_range(
Complete calculating climatology and anomaly for calendar of 365_day
Complete power spectra (segment:  730  nps: 5.0 )
Traceback (most recent call last):
  File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20240220/bin/variability_across_timescales_PS_driver.py", line 64, in <module>
    precip_variability_across_timescale(
  File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20240220/lib/python3.10/site-packages/pcmdi_metrics/precip_variability/lib/lib_variability_across_timescales.py", line 87, in precip_variability_across_timescale
    psdmfm_forced = Avg_PS_DomFrq(ps, freqs, ntd, dat, mip, "forced", regions_specs)
  File "/home/lee1043/.conda/envs/pcmdi_metrics_dev_20240220/lib/python3.10/site-packages/pcmdi_metrics/precip_variability/lib/lib_variability_across_timescales.py", line 496, in Avg_PS_DomFrq
    if "Ocean" in dom or regions_specs[dom].get("value", -1) == 0:
TypeError: 'NoneType' object is not subscriptable

@acordonez
Copy link
Collaborator Author

@lee1043 I've pushed a fix that I think should resolve this issue (it worked on the command line on perlmutter for me).

@lee1043
Copy link
Contributor

lee1043 commented Aug 26, 2024

@lee1043 I've pushed a fix that I think should resolve this issue (it worked on the command line on perlmutter for me).

Thanks, it helped resolving the aforementioned error. I am continuing to test the rest part of demo 7, and once they all run without error, I will try the shape file, and keep you updated.

@lee1043
Copy link
Contributor

lee1043 commented Aug 26, 2024

In demo 7, it looks like there was a naming change, did I get that right?:
PS_pr.day_regrid.180x90_area.freq.mean_GISS-E2-H.r6i1p1.json to PS_pr.day_regrid.3x3_area.freq.mean_GISS-E2-H.r6i1p1.json (180x90 to 3x3)

@acordonez Could you please double check running demo 7 all cells on your end and make any necessary updates?

@acordonez
Copy link
Collaborator Author

@lee1043 The file should not be renamed, that was a bug. I've pushed the fix and the notebook should run without error now.

@lee1043
Copy link
Contributor

lee1043 commented Sep 24, 2024

Confirmed that demo notebook 7 works fine with the PR.

@lee1043 lee1043 merged commit efc2ecb into main Sep 24, 2024
5 checks passed
@lee1043 lee1043 deleted the ao_update_precip_var branch September 24, 2024 16:11
@acordonez
Copy link
Collaborator Author

@lee1043 Thank you for your review!

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