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

retro nwm 3.0 url bug #52

Closed
JordanLaserGit opened this issue Apr 24, 2024 · 3 comments
Closed

retro nwm 3.0 url bug #52

JordanLaserGit opened this issue Apr 24, 2024 · 3 comments
Assignees

Comments

@JordanLaserGit
Copy link

This conf_nwmurl.json

{
  "forcing_type": "retrospective",
  "start_date": "202001200100",
  "end_date": "202001200100",
  "urlbaseinput": 4,
  "selected_object_type": [
    1
  ],
  "selected_var_types": [
    6
  ],
  "write_to_file": true
}

yields this retro_filenamelist.txt

https://noaa-nwm-retrospective-3-0-pds.s3.amazonaws.com/CONUS/netcdf/forcing/2020/2020012001.LDASIN_DOMAIN1

but I think it should be

https://noaa-nwm-retrospective-3-0-pds.s3.amazonaws.com/CONUS/netcdf/FORCING/2020/202001200100.LDASIN_DOMAIN1

so there's just two missing digits for the minutes, not sure why they are required.

@jameshalgren
Copy link
Member

Good catch. @RohanSunkarapalli Can you address?

@RohanSunkarapalli
Copy link
Collaborator

Yes @jameshalgren , that's right. I gave that condition because when I observed the bucket we saw that the files from year 2007 doesn't have "00" appended to the date format whereas the files from 90's to 2006 has "00" at the tail of the date format.

I gave this condition -

if "forcing" in file_type and date.year < 2007:

But if you think it's not needed anymore it could be corrected by modifying the code to this way -

def generate_url_retro(date, file_type, urlbase_prefix, retrospective_var_types=None):
year_txt = date.strftime("%Y")
date_txt = date.strftime("%Y%m%d%H%M") # Updated to include minutes

if "forcing" in file_type and date.year < 2007:
    url = f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}.LDASIN_DOMAIN1"
elif "forcing" in file_type and date.year >= 2007:
    url = f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}.LDASIN_DOMAIN1"
elif "model_output" in file_type:
    url = [
        f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}{type}"
        for type in retrospective_var_types
    ]

if urlbase_prefix == "https://ciroh-nwm-zarr-retrospective-data-copy.s3.amazonaws.com/noaa-nwm-retrospective-2-1-zarr-pds/":
    for url in url: 
        url = url + ".json"
        url = url.replace('.comp', '')
return url

@jameshalgren
Copy link
Member

Addressed by #57

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

No branches or pull requests

4 participants