Skip to content

Commit

Permalink
rebase prep
Browse files Browse the repository at this point in the history
  • Loading branch information
James S. Halgren committed Oct 31, 2023
1 parent 579f8fb commit 3ba2c31
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 14 deletions.
18 changes: 16 additions & 2 deletions test/test_analysis_assim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pytest
from urlgennwm import generate_urls
from urlgennwm import generate_urls_operational


@pytest.fixture
def generated_urls():
Expand All @@ -13,11 +14,24 @@ def generated_urls():
runinput = 5 # Set to 5 for the analysis_assim folder
urlbaseinput = 2
meminput = 1
fileoutput = True

generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput)
generate_urls_operational(
start_date,
end_date,
fcst_cycle,
lead_time,
varinput,
geoinput,
runinput,
urlbaseinput,
meminput,
fileoutput,
)

yield


def test_generate_urls_for_analysis_assim(generated_urls):
assert os.path.exists("filenamelist.txt")

Expand Down
22 changes: 19 additions & 3 deletions test/test_analysis_extend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pytest
from urlgennwm import generate_urls
from urlgennwm import generate_urls_operational


@pytest.fixture
def generated_urls_for_analysis_assim_extend():
Expand All @@ -13,12 +14,27 @@ def generated_urls_for_analysis_assim_extend():
runinput = 6
urlbaseinput = 2
meminput = 1
fileoutput = True

generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput)
generate_urls_operational(
start_date,
end_date,
fcst_cycle,
lead_time,
varinput,
geoinput,
runinput,
urlbaseinput,
meminput,
fileoutput,
)

yield

def test_generate_urls_for_analysis_assim_extend(generated_urls_for_analysis_assim_extend):

def test_generate_urls_for_analysis_assim_extend(
generated_urls_for_analysis_assim_extend,
):
assert os.path.exists("filenamelist.txt")

expected_urls = [
Expand Down
26 changes: 20 additions & 6 deletions test/test_conus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pytest
from urlgennwm import generate_urls
from urlgennwm import generate_urls_operational


@pytest.fixture
def generated_urls():
Expand All @@ -13,20 +14,33 @@ def generated_urls():
runinput = 1
urlbaseinput = 2
meminput = 1
fileoutput = True

generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput)
generate_urls_operational(
start_date,
end_date,
fcst_cycle,
lead_time,
varinput,
geoinput,
runinput,
urlbaseinput,
meminput,
fileoutput,
)

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'
"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:
Expand Down
22 changes: 19 additions & 3 deletions test/test_forcing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pytest
from urlgennwm import generate_urls
from urlgennwm import generate_urls_operational


@pytest.fixture
def generated_urls_for_forcing_medium_range():
Expand All @@ -13,10 +14,25 @@ def generated_urls_for_forcing_medium_range():
runinput = 2
urlbaseinput = 1
meminput = 1
fileoutput = True

generate_urls(start_date, end_date, fcst_cycle, lead_time, varinput, geoinput, runinput, urlbaseinput, meminput)
generate_urls_operational(
start_date,
end_date,
fcst_cycle,
lead_time,
varinput,
geoinput,
runinput,
urlbaseinput,
meminput,
fileoutput,
)

yield

def test_generate_urls_for_forcing_medium_range(generated_urls_for_forcing_medium_range):

def test_generate_urls_for_forcing_medium_range(
generated_urls_for_forcing_medium_range,
):
assert os.path.exists("filenamelist.txt")

0 comments on commit 3ba2c31

Please sign in to comment.