Skip to content

Commit

Permalink
Merge pull request #39 from sepehrkrz/main
Browse files Browse the repository at this point in the history
Version 0.2.0 fixed .json extension in retrospective data
  • Loading branch information
sepehrkrz authored Nov 14, 2023
2 parents 5c7baaa + bc01691 commit 5fce81d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .ipynb_checkpoints/setup-checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"""

# Other information
VERSION = "0.1.8"
VERSION = "0.2.0"
DESCRIPTION = "URL generator tool for National Water Model data"

setup(
Expand Down
7 changes: 5 additions & 2 deletions nwmurl/.ipynb_checkpoints/urlgennwm-checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def create_file_list(
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")

if "forcing" in file_type and date.year < 2007:
url = f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}00.LDASIN_DOMAIN1"
elif "forcing" in file_type and date.year >= 2007:
Expand All @@ -493,7 +493,10 @@ def generate_url_retro(date, file_type, urlbase_prefix, retrospective_var_types=
f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}00{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"
return url


Expand Down
Binary file added nwmurl/__pycache__/urlgennwm.cpython-310.pyc
Binary file not shown.
13 changes: 8 additions & 5 deletions nwmurl/urlgennwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def create_file_list(
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")

if "forcing" in file_type and date.year < 2007:
url = f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}00.LDASIN_DOMAIN1"
elif "forcing" in file_type and date.year >= 2007:
Expand All @@ -493,7 +493,10 @@ def generate_url_retro(date, file_type, urlbase_prefix, retrospective_var_types=
f"{urlbase_prefix}{file_type}{year_txt}/{date_txt}00{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"
return url


Expand Down Expand Up @@ -565,7 +568,7 @@ def generate_urls_operational(
if write_to_file == True:
if os.path.exists("filenamelist.txt"):
os.remove("filenamelist.txt")
with open("filenamelist.txt", "wt") as file:
for item in file_list:
file.write(f"{item}\n")
with open("filenamelist.txt", "wt") as file:
for item in file_list:
file.write(f"{item}\n")
return file_list
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"""

# Other information
VERSION = "0.1.9"
VERSION = "0.2.0"
DESCRIPTION = "URL generator tool for National Water Model data"

setup(
Expand Down

0 comments on commit 5fce81d

Please sign in to comment.