Skip to content

Commit

Permalink
individual Cx writer tests for vis, surf param a/b
Browse files Browse the repository at this point in the history
  • Loading branch information
ctgh committed Feb 19, 2024
1 parent b8f8dcf commit e511cb8
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ ADD_WRITER_TEST(NAME cxwriter_006_SurfaceCxField_v10
YAML 006_SurfaceCxField_v10.yaml
NAMELIST CxWriterNamelists_006_SurfaceCxField_v10/AMSUB.nl
DATA 006_SurfaceCxField_v10.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_008_SurfaceCxField_visibility_1p5m
YAML 008_SurfaceCxField_visibility_1p5m.yaml
NAMELIST CxWriterNamelists_008_SurfaceCxField_visibility_1p5m/Surface.nl
DATA 008_SurfaceCxField_visibility_1p5m.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_013_SurfaceCxField_TskinSea
YAML 013_SurfaceCxField_TskinSea.yaml
NAMELIST CxWriterNamelists_013_SurfaceCxField_TskinSea/AMSUB.nl
Expand All @@ -400,6 +404,14 @@ ADD_WRITER_TEST(NAME cxwriter_017_SurfaceCxField_SeaIce
YAML 017_SurfaceCxField_SeaIce.yaml
NAMELIST CxWriterNamelists_017_SurfaceCxField_SeaIce/AMSUB.nl
DATA 017_SurfaceCxField_SeaIce.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_022_SurfaceCxField_surf_param_a
YAML 022_SurfaceCxField_surf_param_a.yaml
NAMELIST CxWriterNamelists_022_SurfaceCxField_surf_param_a/Surface.nl
DATA 022_SurfaceCxField_surf_param_a.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_023_SurfaceCxField_surf_param_b
YAML 023_SurfaceCxField_surf_param_b.yaml
NAMELIST CxWriterNamelists_023_SurfaceCxField_surf_param_b/Surface.nl
DATA 023_SurfaceCxField_surf_param_b.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_024_SurfaceCxField_CloudAmount
YAML 024_SurfaceCxField_CloudAmount.yaml
NAMELIST CxWriterNamelists_024_SurfaceCxField_CloudAmount/SatTCWV.nl
Expand Down
3 changes: 3 additions & 0 deletions test/generate_unittest_netcdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,12 @@ def copy_var_to_var(Group, invarname, outvarname, filename):
output_1d_geoval_to_netcdf ('relative_humidity_2m', 'testinput/004_SurfaceCxField_rh2.nc4')
output_1d_geoval_to_netcdf ('uwind_at_10m', 'testinput/005_SurfaceCxField_u10.nc4')
output_1d_geoval_to_netcdf ('vwind_at_10m', 'testinput/006_SurfaceCxField_v10.nc4')
output_1d_geoval_to_netcdf ('visibility_1p5m', 'testinput/008_SurfaceCxField_visibility_1p5m.nc4')
output_1d_geoval_to_netcdf ('skin_temperature', 'testinput/013_SurfaceCxField_TskinSea.nc4')
output_1d_geoval_to_netcdf ('surface_pressure_at_mean_sea_level', 'testinput/016_SurfaceCxField_pmsl.nc4')
output_1d_geoval_to_netcdf ('ice_area_fraction', 'testinput/017_SurfaceCxField_SeaIce.nc4')
output_1d_geoval_to_netcdf ('surf_param_a', 'testinput/022_SurfaceCxField_surf_param_a.nc4')
output_1d_geoval_to_netcdf ('surf_param_b', 'testinput/023_SurfaceCxField_surf_param_b.nc4')
output_1d_geoval_to_netcdf ('total_cloud_amount', 'testinput/024_SurfaceCxField_CloudAmount.nc4')
output_1d_geoval_to_netcdf ('obukhov_length', 'testinput/056_SurfaceCxField_obukhov_length.nc4')
output_1d_geoval_to_netcdf ('friction_velocity_over_water', 'testinput/057_SurfaceCxField_friction_velocity_over_water.nc4')
Expand Down
Binary file not shown.
41 changes: 41 additions & 0 deletions test/testinput/008_SurfaceCxField_visibility_1p5m.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
time window:
begin: 2018-01-01T00:00:00Z
end: 2018-01-01T01:00:00Z

observations:
- obs space:
name: Surface
obsdatain:
engine:
type: H5File
obsfile: Data/dummy.nc4
simulated variables: [dummy]
geovals:
filename: Data/008_SurfaceCxField_visibility_1p5m.nc4
obs filters:
# Set the flag of observations with missing values to "pass": we want to check if these
# values are encoded correctly in the Cx file.
- filter: Reset Flags to Pass
flags_to_reset: [10, 15] # missing, Hfailed
# Reject observation 3: we want to check if it is omitted from the Cx file, as expected.
- filter: Domain Check
where:
- variable:
name: MetaData/latitude
minvalue: 0.0
- filter: Cx Writer
namelist_directory: testinput/CxWriterNamelists_008_SurfaceCxField_visibility_1p5m
reject_obs_with_any_variable_failing_qc: true
general_mode: debug
IC_PLevels: 5
- filter: Cx Checker
expected_surface_variables: ["8"] # IndexCxvisibility_1p5m
expected_upper_air_variables: []
expected_main_table_columns:
- # batch 1
- ["7.10"] # column 1
- ["**********"] # column 2 (the asterisks represent a missing float)
- ["7.40"] # column 3
HofX: ObsValue # just a placeholder -- not used, but needed to force calls to postFilter.
benchmarkFlag: 1000 # just to keep the ObsFilters test happy
flaggedBenchmark: 0
Binary file not shown.
41 changes: 41 additions & 0 deletions test/testinput/022_SurfaceCxField_surf_param_a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
time window:
begin: 2018-01-01T00:00:00Z
end: 2018-01-01T01:00:00Z

observations:
- obs space:
name: Surface
obsdatain:
engine:
type: H5File
obsfile: Data/dummy.nc4
simulated variables: [dummy]
geovals:
filename: Data/022_SurfaceCxField_surf_param_a.nc4
obs filters:
# Set the flag of observations with missing values to "pass": we want to check if these
# values are encoded correctly in the Cx file.
- filter: Reset Flags to Pass
flags_to_reset: [10, 15] # missing, Hfailed
# Reject observation 3: we want to check if it is omitted from the Cx file, as expected.
- filter: Domain Check
where:
- variable:
name: MetaData/latitude
minvalue: 0.0
- filter: Cx Writer
namelist_directory: testinput/CxWriterNamelists_022_SurfaceCxField_surf_param_a
reject_obs_with_any_variable_failing_qc: true
general_mode: debug
IC_PLevels: 5
- filter: Cx Checker
expected_surface_variables: ["22"] # IndexCxsurf_param_a
expected_upper_air_variables: []
expected_main_table_columns:
- # batch 1
- ["7.10"] # column 1
- ["**********"] # column 2 (the asterisks represent a missing float)
- ["7.40"] # column 3
HofX: ObsValue # just a placeholder -- not used, but needed to force calls to postFilter.
benchmarkFlag: 1000 # just to keep the ObsFilters test happy
flaggedBenchmark: 0
Binary file not shown.
41 changes: 41 additions & 0 deletions test/testinput/023_SurfaceCxField_surf_param_b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
time window:
begin: 2018-01-01T00:00:00Z
end: 2018-01-01T01:00:00Z

observations:
- obs space:
name: Surface
obsdatain:
engine:
type: H5File
obsfile: Data/dummy.nc4
simulated variables: [dummy]
geovals:
filename: Data/023_SurfaceCxField_surf_param_b.nc4
obs filters:
# Set the flag of observations with missing values to "pass": we want to check if these
# values are encoded correctly in the Cx file.
- filter: Reset Flags to Pass
flags_to_reset: [10, 15] # missing, Hfailed
# Reject observation 3: we want to check if it is omitted from the Cx file, as expected.
- filter: Domain Check
where:
- variable:
name: MetaData/latitude
minvalue: 0.0
- filter: Cx Writer
namelist_directory: testinput/CxWriterNamelists_023_SurfaceCxField_surf_param_b
reject_obs_with_any_variable_failing_qc: true
general_mode: debug
IC_PLevels: 5
- filter: Cx Checker
expected_surface_variables: ["23"] # IndexCxsurf_param_b
expected_upper_air_variables: []
expected_main_table_columns:
- # batch 1
- ["7.10"] # column 1
- ["**********"] # column 2 (the asterisks represent a missing float)
- ["7.40"] # column 3
HofX: ObsValue # just a placeholder -- not used, but needed to force calls to postFilter.
benchmarkFlag: 1000 # just to keep the ObsFilters test happy
flaggedBenchmark: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
&CXControlNL
CxFields=3247
/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
&CXControlNL
CxFields=20000
/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
&CXControlNL
CxFields=20001
/

0 comments on commit e511cb8

Please sign in to comment.