Skip to content

Adapt ERA5 atmospheric forcing generation script #22

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

s-poll
Copy link
Member

@s-poll s-poll commented Mar 24, 2025

closes #13

s-poll added 11 commits March 23, 2025 13:49
- remove old download scripts
- new download request
- add year, month and output directory as input for download script
- adapt script to new CDSAPI
- add argument parser for script
- rename of SHUM to QBOT
- add argument parser
- add input variables and defaults
- add running_jobs functionality
 replace unzip with python as unzip is not available at JSC compute nodes.
@s-poll s-poll marked this pull request as ready for review April 8, 2025 15:00
@s-poll s-poll requested a review from mvhulten April 8, 2025 15:00
mvhulten added 2 commits April 9, 2025 17:00
- Use python3 in hashbang for cross-platform and rely on it
- Exit on error
- No tab characters
ATM, the link https://cds.climate.copernicus.eu/how-to-api is deadish.
Referring now also to ECMWF GitHub README.

# Go into working directory and create temporary directory
if [ -z ${wrkdir} ];then
wrkdir=${iyear}-${imonth}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be right (and the behaviour will be hard to predict when there is more than one element in iyear or imonth).

Moreover, I don't like the whole naming here. When I see a word prefixed with i, I think of index or a scalar or maybe an integer, but NOT an array. It is also all confusing in mkforcing/extract_ERA5_meteocloud.sh and I think picking a natural naming scheme would help.

I'd use singular for elements and plural for arrays, so for month in ${months} &c.
(Interestingly, I'd read for imonth in ${months} correctly as well.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date command parameters are not standard and fail on BSD (and probably macOSX).

Is a wrapper (in Bash) needed? Why not pass the user arguments to download_ERA5_input.py?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the linked standard is maybe overly restricted. At least on OpenBSD there is no -I or -d.

Also breaks on OSX: no -I and -d does something else.

I don't know how to make it platform indenpendent in (Bourne) shell. Python would be nice (and better to use python3 and rely on shebang).

@@ -0,0 +1,80 @@
#!/usr/bin/env python
import calendar
import cdsapi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include a pip install cdsapi in the README?
This would be the first time that this is needed (the rest we relied on modules).

edit: ah, except for the NCL script they need to evben do a conda install ncl!
To some extend, mess must maybe be accepted…

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed; it is written in the linked documentation.

mkdir -pv $tmpdir

if $lrmp; then
python -m zipfile -e ${pathdata}/download_era5_${year}_${month}.zip ${tmpdir}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, there is an Lmod module UnZip, which may be nicer for a Bash script.
But I also don't want to fix what's not broken®.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get some warnings:

Process 2017-07-31-23 prun: 744
cdi  warning (gribapiScanTimestep1): Record 1509 (name=z id=4.3.0 lev1=1 lev2=0) timestep 1: Inconsistent verification time!
...

Copy link
Collaborator

@mvhulten mvhulten Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use here years instead of the faulty iyear (to be fixed by @s-poll), so it's consistent with near-future changeset.

  • ./extract_ERA5_meteocloud.sh years=2017 months=07 works
  • ./extract_ERA5_meteocloud.sh years=2017 months=7` fails
  • ./extract_ERA5_meteocloud.sh iyear=2017 imonth=7 ihour=(00 01) fails
  • ./extract_ERA5_meteocloud.sh iyear=2017 imonth=7 ihour=(00 01) fails
  • There is no days, but maybe this was intentional
  • Check for meteocloud_${year}_${month}.{grb,nc} at start of script is nice to have (to catch unnecessary recomputation) but optional

Copy link
Collaborator

@mvhulten mvhulten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See unresolved conversations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adapt ERA5 atmospheric forcing generation scripts
2 participants