Skip to content

Commit

Permalink
Fix tests (#677)
Browse files Browse the repository at this point in the history
Fix failing tests.

Remove tests that use no longer supported features (RadioLink, Relmat).

Planetary toolbox removed.

Speed up "fast" instrument tests by reducing number of species (MVIRI,
SEVIRI, HIRS).

TestIyActive_wfuns uncovered a serious bug where dpnd_field_dx was not
properly initialized.

Fixed error in TestHIRS_reference. `f_gridFromSensorHIRS` ignored
leading/trailing zeros in the `backend_channel_response` to determine
the lowest required frequency in `f_backend` while
`sensor_responseBackend` did not. Adjusted `f_gridFromSensorHIRS`
accordingly.

Closes #671
  • Loading branch information
olemke authored Oct 10, 2023
2 parents 5f4ac7c + 5224c74 commit 4d2fc74
Show file tree
Hide file tree
Showing 155 changed files with 18,528 additions and 22,528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@


def setup_testcase(ws):
ws.execute_controlfile("general/continua.arts")
ws.execute_controlfile("general/agendas.arts")
ws.execute_controlfile("general/planet_earth.arts")
ws.water_p_eq_agendaSet()
ws.gas_scattering_agendaSet()
ws.PlanetSet(option="Earth")

# (standard) emission calculation
ws.Copy(ws.iy_main_agenda, ws.iy_main_agenda__Emission)
ws.iy_main_agendaSet(option="Emission")
# cosmic background radiation
ws.Copy(ws.iy_space_agenda, ws.iy_space_agenda__CosmicBackground)
ws.iy_space_agendaSet()
# sensor-only path
ws.ppath_agendaSet(option="FollowSensorLosPath")
# no refraction
ws.ppath_step_agendaSet(option="GeometricPath")

@arts_agenda
def iy_surface_agenda_PY(ws):
# upwelling intensity (and jacobian) from the surface for given point and direction
@arts_agenda(ws=ws, set_agenda=True)
def iy_surface_agenda(ws):
ws.SurfaceBlackbody()
ws.iySurfaceRtpropCalc()
# upwelling intensity (and jacobian) from the surface for given point and direction
ws.Copy(ws.iy_surface_agenda, iy_surface_agenda_PY)
ws.iy_surface_agenda = iy_surface_agenda
# called by iySurfaceRtpropCalc within iy_surface_agenda
ws.Copy(ws.surface_rtprop_agenda, ws.surface_rtprop_agenda__Specular_NoPol_ReflFix_SurfTFromt_surface)
# clearsky agenda
ws.Copy(ws.propmat_clearsky_agenda, ws.propmat_clearsky_agenda__OnTheFly)
# sensor-only path
ws.Copy(ws.ppath_agenda, ws.ppath_agenda__FollowSensorLosPath)
# no refraction
ws.Copy(ws.ppath_step_agenda, ws.ppath_step_agenda__GeometricPath)
ws.Copy(ws.abs_xsec_agenda, ws.abs_xsec_agenda__noCIA)
ws.surface_rtprop_agendaSet(option="Specular_NoPol_ReflFix_SurfTFromt_surface")

ws.stokes_dim = 1
ws.atmosphere_dim = 1 # 1D VAR
Expand All @@ -46,23 +44,24 @@ def iy_surface_agenda_PY(ws):
ws.sensor_responseBackend()

ws.abs_speciesSet(species=[
"H2O, H2O-SelfContCKDMT252, H2O-ForeignContCKDMT252",
"H2O, H2O-SelfContCKDMT350, H2O-ForeignContCKDMT350",
])
ws.abs_lines_per_speciesReadSpeciesSplitCatalog(
basename="spectroscopy/Artscat/"
basename="lines/"
)
ws.abs_lines_per_speciesSetCutoff(option="ByLine", value=750e9)
ws.abs_lines_per_speciesCutoff(option="ByLine", value=750e9)
ws.abs_lines_per_speciesCompact()
ws.abs_xsec_agenda_checkedCalc()
# clearsky agenda
ws.propmat_clearsky_agendaAuto()
ws.lbl_checkedCalc()

# Load atmospheric data to be forward simulated
ws.ReadXML(ws.batch_atm_fields_compact, 'testdata/garand_profiles.xml.gz')
ws.propmat_clearsky_agenda_checkedCalc()

ws.VectorCreate("t_surface_vector") # helper variable for ybatch_calc_agenda
ws.NumericCreate("t_surface_numeric") # helper variable for ybatch_calc_agenda
@arts_agenda

@arts_agenda(ws=ws, set_agenda=True)
def ybatch_calc_agenda(ws):
ws.Extract(ws.atm_fields_compact,
ws.batch_atm_fields_compact,
Expand All @@ -84,7 +83,6 @@ def ybatch_calc_agenda(ws):
ws.sensor_checkedCalc()
ws.yCalc()

ws.Copy(ws.ybatch_calc_agenda, ybatch_calc_agenda)
ws.IndexSet(ws.ybatch_start, 0)
ws.IndexSet(ws.ybatch_n, 1) # Amount of atmospheres
ws.ybatchCalc() # conduct the forward simulation
Expand All @@ -93,14 +91,14 @@ def ybatch_calc_agenda(ws):

# test for ybatch
def test_ybatch(ws):
ybatch_ref = np.array([256.9629541])
ybatch_ref = np.array([257.00247])
assert np.allclose(ws.ybatch.value[0], ybatch_ref)


# test for ybatch_jacobians
def test_ybatch_jacobians(ws):
ybatch_jacobians_ref = np.array([[3.38580056e-06]])
assert np.allclose(ws.ybatch_jacobians.value[0], ybatch_jacobians_ref, atol=1e-12)
ybatch_jacobians_ref = np.array([[4.65258e-06]])
assert np.allclose(ws.ybatch_jacobians.value[0], ybatch_jacobians_ref, atol=1e-6)


if __name__ == '__main__':
Expand Down
48 changes: 8 additions & 40 deletions controlfiles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ arts_test_run_ctlfile(fast artscomponents/pencilbeam/TestPencilBeam.arts)

arts_test_run_ctlfile(fast artscomponents/clearsky/TestClearSky.arts)
arts_test_run_ctlfile(slow artscomponents/clearsky/TestClearSky2.arts)
arts_test_run_ctlfile(fast artscomponents/clearsky/TestClearSky_StarGasScattering.arts)

arts_test_run_ctlfile(fast artscomponents/stokesrot/TestStokesRotation.arts)
arts_test_run_ctlfile(fast artscomponents/stokesrot/TestSensorPol.arts)
Expand All @@ -74,10 +75,6 @@ arts_test_run_ctlfile(fast artscomponents/nlte/TestNLTE.arts)
arts_test_run_ctlfile(fast artscomponents/psd/TestFromParticleBulkProps.arts)
arts_test_run_ctlfile(fast artscomponents/psd/TestPsds.arts)

#arts_test_run_ctlfile(slow artscomponents/radiolink/TestRadioLink.arts)
#arts_test_run_ctlfile(fast artscomponents/radiolink/TestRadioLink2.arts)
#arts_test_run_ctlfile(slow artscomponents/radiolink/TestRadioOccultation.arts)

arts_test_run_ctlfile(fast artscomponents/doit/TestDOIT.arts)
arts_test_run_ctlfile(slow artscomponents/doit/TestDOITaccelerated.arts)
arts_test_run_ctlfile(fast artscomponents/doit/TestDOITprecalcInit.arts)
Expand All @@ -102,7 +99,7 @@ arts_test_run_ctlfile(fast artscomponents/wfuns/TestSurfaceBlackbody.arts)
arts_test_run_ctlfile(fast artscomponents/wfuns/TestSurfaceFlatScalarReflectivity.arts)

arts_test_run_ctlfile(fast artscomponents/radar/TestIyActive.arts)
# arts_test_run_ctlfile(fast artscomponents/radar/TestIyActive_wfuns.arts)
arts_test_run_ctlfile(fast artscomponents/radar/TestIyActive_wfuns.arts)
arts_test_run_ctlfile(fast artscomponents/radar/TestOnionPeeling.arts)

arts_test_run_ctlfile(fast artscomponents/ycalcappend/TestYCalcAppend.arts)
Expand Down Expand Up @@ -139,14 +136,6 @@ if (ENABLE_NETCDF)
arts_test_run_ctlfile(slow artscomponents/moltau/TestMolTau.arts)
endif ()

# if (ENABLE_RELMAT)
# if (FASTWIGNER)
# arts_test_run_ctlfile(fast artscomponents/linemixing/TestRelmat.arts)
# else()
# arts_test_run_ctlfile(slow artscomponents/linemixing/TestRelmat.arts)
# endif()
# endif ()

if (OEM_SUPPORT)
arts_test_run_ctlfile(fast artscomponents/oem/TestOEM.arts)
endif ()
Expand All @@ -162,27 +151,17 @@ arts_test_run_ctlfile(slow instruments/metmm/TestMetMM.arts)

if (ARTS_XML_DATA_DIR)

arts_test_run_ctlfile(slow instruments/avhrr/TestAVHRR_fast.arts)

arts_test_run_ctlfile(slow instruments/mviri/TestMVIRI.arts)

arts_test_run_ctlfile(slow instruments/seviri/TestSEVIRI.arts)

arts_test_run_ctlfile(slow artscomponents/clearsky/TestBatch.arts)
arts_test_run_ctlfile(slow artscomponents/absorption/TestIsoRatios.arts)

###############################
### testing XML Data itself ###
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScen_Mars.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScen_Venus.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScen_Jupiter.arts)

arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScenSup_Earth.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScenSup_Mars.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScenSup_Venus.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestAtmScenSup_Jupiter.arts)

# arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestClouds_Mars.arts)
# arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestClouds_Venus.arts)

arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestSurf_Earth.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestSurf_Mars.arts)
arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestSurf_Venus.arts)

arts_test_run_ctlfile(xmldata artscomponents/arts-xml-data/TestPlanetIsoRatios.arts)

arts_test_run_ctlfile(xmldata artscomponents/cia/TestCIA.arts)
Expand All @@ -198,17 +177,6 @@ if (ARTS_XML_DATA_DIR)

arts_test_run_ctlfile(fast artscomponents/ppath/TestRefractPlanets.arts)

##################################
### planet toolbox demos cases ###
# arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/active/DemoLinkBudget.arts)

#arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoJupiter_fullRT_1D_clearsky.arts)
#arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoMars_fullRT_1D_clearsky.arts)
#arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoMars_fullRT_3D_clearsky.arts)
# arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoMars_fullRT_1D_cloudy.arts)
arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoVenus_fullRT_1D_clearsky.arts)
#arts_test_run_ctlfile(planettoolbox planetary_toolbox/demos/passive/DemoVenus_fullRT_1D_cloudy.arts)

arts_test_run_ctlfile(fast artscomponents/cia/TestCIADerivs.arts)

arts_test_run_ctlfile(slow artscomponents/nlte/testRotationalConvergence.arts)
Expand Down
Loading

0 comments on commit 4d2fc74

Please sign in to comment.