Skip to content

Use yearly ERA5 DATM files - #147

Open
ezhilsabareesh8 wants to merge 3 commits into
mainfrom
era5-yearly-xml
Open

Use yearly ERA5 DATM files#147
ezhilsabareesh8 wants to merge 3 commits into
mainfrom
era5-yearly-xml

Conversation

@ezhilsabareesh8

Copy link
Copy Markdown
Contributor

Update generate_xml_datm_era5.py to generate yearly ERA5 DATM file paths instead of monthly paths.

The XML now expects payu-staged files like:

./INPUT/{stream}/{stream}_era5_oper_sfc_YYYY0101-YYYY1231.nc

and handles partial 2026 as:

./INPUT/{stream}/{stream}_era5_oper_sfc_20260101-20260331.nc

@anton-seaice anton-seaice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it intentional to remove support for RYF ?

# Use the first source variable for RYF file naming.
driver_src_var = datavar_pairs[0][0]

for year in range(year_first, year_last + 1):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably more robust to get the file names from the actual files,

e.g. something like:

from glob import glob
from pathlib import Path

root_dir = Path(f'/g/data/rt52/era5/single-levels/reanalysis/{era5_prefix}')
files = glob(f"**/{era5_prefix}_era5_oper_sfc_{year}*.nc", root_dir=dir, recursive=True)
files.sort()

for f in files:
        file_element = SubElement(datafiles, "file")
        file_element.text = f 

(untested)

root_dir needs to be set to whereever the source data is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This means the code should needn't changing when the dataset is extended

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.

2 participants