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

Feature request #403 default time referenced to forecast time #421

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added tests
  • Loading branch information
maartenplieger committed Dec 23, 2024
commit 95490cf130feaf9db934c595ecfbfae52a757cca
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>


<Layer type="database">
<Name>time_default_min</Name>
<Title>time_default_min</Title>
<Variable>air-temperature-pl</Variable>
<FilePath
filter="^uwcw_ha43_dini_5p5km_air-temperature-pl_geoweb_nc_20240711T0.*_TEST_10x8\.nc$">
{ADAGUC_PATH}data/datasets/ha43_dini/</FilePath>
<Styles>temperature_wow</Styles>
<Dimension name="forecast_reference_time" units="ISO8601" default="max">reference_time</Dimension>
<Dimension name="temp_at_pl" units="hPa" default="max" hidden="false">pressure_level_in_hpa</Dimension>
<Dimension name="time" units="ISO8601" interval="PT1H" default="min">time</Dimension>

</Layer>
<Layer type="database">
<Name>time_default_max</Name>
<Title>time_default_max</Title>
<Variable>air-temperature-pl</Variable>
<FilePath
filter="^uwcw_ha43_dini_5p5km_air-temperature-pl_geoweb_nc_20240711T0.*_TEST_10x8\.nc$">
{ADAGUC_PATH}data/datasets/ha43_dini/</FilePath>
<Styles>temperature_wow</Styles>
<Dimension name="forecast_reference_time" units="ISO8601" default="max">reference_time</Dimension>
<Dimension name="temp_at_pl" units="hPa" default="max" hidden="false">pressure_level_in_hpa</Dimension>
<Dimension name="time" units="ISO8601" interval="PT1H" default="max">time</Dimension>

</Layer>

<Layer type="database">
<Name>time_default_forecast_reference_time</Name>
<Title>time_default_forecast_reference_time</Title>
<Variable>air-temperature-pl</Variable>
<FilePath
filter="^uwcw_ha43_dini_5p5km_air-temperature-pl_geoweb_nc_20240711T0.*_TEST_10x8\.nc$">
{ADAGUC_PATH}data/datasets/ha43_dini/</FilePath>
<Styles>temperature_wow</Styles>
<Dimension name="forecast_reference_time" units="ISO8601" default="max">reference_time</Dimension>
<Dimension name="temp_at_pl" units="hPa" default="max" hidden="false">pressure_level_in_hpa</Dimension>
<Dimension name="time" units="ISO8601" interval="PT1H" default="forecast_reference_time">
time</Dimension>

</Layer>


<Layer type="database">
<Name>time_default_forecast_reference_time_and_duration</Name>
<Title>time_default_forecast_reference_time_and_duration</Title>
<Variable>air-temperature-pl</Variable>
<FilePath
filter="^uwcw_ha43_dini_5p5km_air-temperature-pl_geoweb_nc_20240711T0.*_TEST_10x8\.nc$">
{ADAGUC_PATH}data/datasets/ha43_dini/</FilePath>
<Styles>temperature_wow</Styles>
<Dimension name="forecast_reference_time" units="ISO8601" default="max">reference_time</Dimension>
<Dimension name="temp_at_pl" units="hPa" default="max" hidden="false">pressure_level_in_hpa</Dimension>
<Dimension name="time" units="ISO8601" interval="PT1H"
default="forecast_reference_time+PT1H">time</Dimension>

</Layer>


</Configuration>
34 changes: 34 additions & 0 deletions tests/AdagucTests/TestWMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2598,3 +2598,37 @@ def test_WMSGetLegendGraphic_SolarTerminator(self):
data.getvalue(),
AdagucTestTools().readfromfile(self.expectedoutputsspath +
filename))



def test_WMSGetCapabilities_403_default_time_referenced_to_forecast_time(self):
"""
See https://github.com/KNMI/adaguc-server/issues/403
"""
AdagucTestTools().cleanTempDir()

config = (
ADAGUC_PATH
+ "/data/config/adaguc.tests.dataset.xml,"
+ ADAGUC_PATH
+ "/data/config/datasets/adaguc.tests.403_default_time_referenced_to_forecast_time.xml"
)
# pylint: disable=unused-variable
status, data, headers = AdagucTestTools().runADAGUCServer(
args=["--updatedb", "--config", config], env=self.env, isCGI=False
)
self.assertEqual(status, 0)

filename = "test_WMSGetCapabilities_403_default_time_referenced_to_forecast_time.xml"
# pylint: disable=unused-variable
status, data, headers = AdagucTestTools().runADAGUCServer(
"dataset=adaguc.tests.403_default_time_referenced_to_forecast_time&service=WMS&request=GetCapabilities",
{"ADAGUC_CONFIG": ADAGUC_PATH + "/data/config/adaguc.tests.dataset.xml"},
)
AdagucTestTools().writetofile(self.testresultspath + filename, data.getvalue())
self.assertEqual(status, 0)
self.assertTrue(
AdagucTestTools().compareGetCapabilitiesXML(
self.testresultspath + filename, self.expectedoutputsspath + filename
)
)
Loading