forked from CIROH-UA/nwmurl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added analysis_assim, extend, conus, forcing
- Loading branch information
James S. Halgren
committed
Oct 31, 2023
1 parent
ee4da98
commit cd6fd25
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
import pytest | ||
from urlgennwm import generate_urls | ||
|
||
@pytest.fixture | ||
def generated_urls(): | ||
start_date = "202201120000" | ||
end_date = "202201130000" | ||
fcst_cycle = [0, 8] | ||
lead_time = [1, 18] | ||
varinput = 1 | ||
geoinput = 1 | ||
runinput = 5 # Set to 5 for the analysis_assim folder | ||
urlbaseinput = 2 | ||
meminput = 1 | ||
|
||
generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput) | ||
|
||
yield | ||
|
||
def test_generate_urls_for_analysis_assim(generated_urls): | ||
assert os.path.exists("filenamelist.txt") | ||
|
||
expected_urls = [ | ||
"https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20220112/analysis_assim/nwm.t00z.analysis_assim.channel_rt.tm001.conus.nc", | ||
"https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20220112/analysis_assim/nwm.t00z.analysis_assim.channel_rt.tm018.conus.nc", | ||
# Add more expected URLs here for the analysis_assim folder | ||
] | ||
|
||
with open("filenamelist.txt", "r") as file: | ||
content = file.read() | ||
for url in expected_urls: | ||
assert url in content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import pytest | ||
from urlgennwm import generate_urls | ||
|
||
@pytest.fixture | ||
def generated_urls_for_analysis_assim_extend(): | ||
start_date = "202201120000" | ||
end_date = "202201130000" | ||
fcst_cycle = [16] | ||
lead_time = [28] | ||
varinput = 1 | ||
geoinput = 1 | ||
runinput = 6 | ||
urlbaseinput = 2 | ||
meminput = 1 | ||
|
||
generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput) | ||
|
||
yield | ||
|
||
def test_generate_urls_for_analysis_assim_extend(generated_urls_for_analysis_assim_extend): | ||
assert os.path.exists("filenamelist.txt") | ||
|
||
expected_urls = [ | ||
"https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20220112/analysis_assim_extend/nwm.t16z.analysis_assim_extend.channel_rt.tm028.conus.nc", | ||
# Add more expected URLs here for the analysis_assim_extend folder | ||
] | ||
|
||
with open("filenamelist.txt", "r") as file: | ||
content = file.read() | ||
for url in expected_urls: | ||
assert url in content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import pytest | ||
from urlgennwm import generate_urls | ||
|
||
@pytest.fixture | ||
def generated_urls(): | ||
start_date = "202310150000" | ||
end_date = "202310150000" | ||
fcst_cycle = [0, 8] | ||
lead_time = [1, 18] | ||
varinput = 1 | ||
geoinput = 1 # Assuming this is for "conus" | ||
runinput = 1 | ||
urlbaseinput = 2 | ||
meminput = 1 | ||
|
||
generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput) | ||
|
||
yield | ||
|
||
def test_generate_urls_for_conus(generated_urls): | ||
assert os.path.exists("filenamelist.txt") | ||
|
||
# Modify the expected URL to match the "conus" geography | ||
expected_urls = [ | ||
'https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20231015/short_range/nwm.t00z.short_range.channel_rt.f001.conus.nc', | ||
'https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20231015/short_range/nwm.t00z.short_range.channel_rt.f018.conus.nc', | ||
'https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20231015/short_range/nwm.t08z.short_range.channel_rt.f001.conus.nc', | ||
'https://nomads.ncep.noaa.gov/pub/data/nccf/com/nwm/post-processed/WMS/nwm.20231015/short_range/nwm.t08z.short_range.channel_rt.f018.conus.nc' | ||
] | ||
|
||
with open("filenamelist.txt", "r") as file: | ||
content = file.read() | ||
for url in expected_urls: | ||
assert url in content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
import pytest | ||
from urlgennwm import generate_urls | ||
|
||
@pytest.fixture | ||
def generated_urls_for_forcing_medium_range(): | ||
start_date = "202201120000" | ||
end_date = "202201130000" | ||
fcst_cycle = [0, 12] | ||
lead_time = [6, 120] | ||
varinput = 5 | ||
geoinput = 1 | ||
runinput = 2 | ||
urlbaseinput = 1 | ||
meminput = 1 | ||
|
||
generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput) | ||
|
||
yield | ||
|
||
def test_generate_urls_for_forcing_medium_range(generated_urls_for_forcing_medium_range): | ||
assert os.path.exists("filenamelist.txt") |