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

Crop HRDPS continental GRIB files to SalishSeaCast sub-domain after they are downloaded #173

Merged
merged 18 commits into from
Apr 7, 2023

Conversation

douglatornell
Copy link
Member

New default operation processes cropped GRIB files produced by
crop_gribs worker. --full-continental-grid option enables
processing of HRDPS continental grid files as received from
ECCC/MSC datamart/hpfx servers.
From https://github.com/ecmwf/cfgrib/README.rst:
    By default cfgrib saves the index of the GRIB file to disk appending .idx to
    the GRIB file name. Index files are an experimental and completely optional
    feature, feel free to remove them and try again in case of problems. Index
    files saving can be disabled passing adding indexpath='' to the
    backend_kwargs keyword argument.
Either poorly/undocumented behaviour of GRIB file format, or a bug in
`cfgrib.xarray_to_grib.to_grib()` (which is, admittedly, alpha/experimental)
causes the lon/lat arrays in GRIBs cropped using `cfgrib` to a sub-domain that
encloses the SalishSeaCast NEMO domain to be incorrect; see
https://nbviewer.org/github/SalishSeaCast/analysis-doug/blob/main/notebooks/continental-HRDPS/crop-grib-to-SSC-domain.ipynb.ipynb
@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Merging #173 (af5a02c) into main (2468230) will increase coverage by 0.20%.
The diff coverage is 87.53%.

@@            Coverage Diff             @@
##             main     #173      +/-   ##
==========================================
+ Coverage   75.80%   76.01%   +0.20%     
==========================================
  Files         127      129       +2     
  Lines       16916    17195     +279     
  Branches     1198     1214      +16     
==========================================
+ Hits        12824    13070     +246     
- Misses       4041     4076      +35     
+ Partials       51       49       -2     
Flag Coverage Δ
unittests 76.01% <87.53%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/test_config.py 100.00% <ø> (ø)
tests/workers/test_get_onc_ferry.py 93.16% <22.22%> (-5.97%) ⬇️
nowcast/workers/grib_to_netcdf.py 71.92% <35.48%> (-3.89%) ⬇️
nowcast/workers/crop_gribs.py 80.88% <80.88%> (ø)
tests/test_next_workers.py 99.74% <95.55%> (+0.41%) ⬆️
nowcast/next_workers.py 97.98% <100.00%> (+0.09%) ⬆️
nowcast/workers/collect_weather.py 95.40% <100.00%> (ø)
nowcast/workers/download_weather.py 97.05% <100.00%> (ø)
tests/workers/test_collect_weather.py 99.62% <100.00%> (ø)
tests/workers/test_crop_gribs.py 100.00% <100.00%> (ø)
... and 2 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@douglatornell
Copy link
Member Author

Deployed branch on skookum for production testing starting with 2023-04-05 00Z forecast.

00Z forecast is normally downloaded on evening of previous day (local time).
So, get the forcast date to run crop_gribs for from the GRIBs directory
path in the checklist.
time is somehow getting into dataset from cropped GRIB files so using
full_grid condition wasn't good enough.
Changing the config["weather"]["download"][resolution]["file template"]
key to "ECCC file template" for grib_to_netcdf and crop_gribs didn't get
propogated to collect_weather and download_weather.
cfgrib.xarray_to_grib.to_grib() insists on calling ACPC air_temperature.
So, we fix it.
grib_to_netcdf, after refactor to use HRDPS continental grid subdomain that
is cropped to just what we need to the SalishSeaCast domain, has a much
smaller memory demand. So, the dask cluster on salish is no longer required.
@douglatornell
Copy link
Member Author

Automation finally worked without my intervention to launch forecast2 and nowcast runs on 7-Apr.

Ready to merge 😁

@douglatornell douglatornell marked this pull request as ready for review April 7, 2023 17:07
@douglatornell douglatornell merged commit 352961a into main Apr 7, 2023
@douglatornell douglatornell deleted the crop-gribs branch April 7, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Automation configuration Workers Workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crop HRDPS continental GRIB files to SalishSeaCast sub-domain after they are downloaded
1 participant