Skip to content

Commit

Permalink
Limit zero padding for analysis_assim
Browse files Browse the repository at this point in the history
  • Loading branch information
RohanSunkarapalli committed Feb 20, 2024
1 parent 1542eca commit bf2e22b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion nwmurl/.ipynb_checkpoints/urlgennwm-checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ def makename(

datetxt = f"nwm.{date.strftime('%Y%m%d')}"
foldertxt = f"{run_type}{run_typesuffix}"
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:03d}.{geography}.nc"

# Adjust zero padding for analysis_assim outputs
if "analysis_assim" in run_type:
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:02d}.{geography}.nc"
else:
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:03d}.{geography}.nc"

return f"{urlbase_prefix}{datetxt}/{foldertxt}/{filetxt}"



# setting run_type
def run_type(runinput, varinput, geoinput, default=""):
"""This function takes the numeric command line input and converts to the text used in the url."""
Expand Down
9 changes: 8 additions & 1 deletion nwmurl/urlgennwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ def makename(

datetxt = f"nwm.{date.strftime('%Y%m%d')}"
foldertxt = f"{run_type}{run_typesuffix}"
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:03d}.{geography}.nc"

# Adjust zero padding for analysis_assim outputs
if "analysis_assim" in run_type:
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:02d}.{geography}.nc"
else:
filetxt = f"nwm.t{fcst_cycle:02d}z.{run_name}{runsuffix}.{var_name}{varsuffix}.{fhprefix}{fcst_hour:03d}.{geography}.nc"

return f"{urlbase_prefix}{datetxt}/{foldertxt}/{filetxt}"



# setting run_type
def run_type(runinput, varinput, geoinput, default=""):
"""This function takes the numeric command line input and converts to the text used in the url."""
Expand Down

0 comments on commit bf2e22b

Please sign in to comment.