Skip to content

Commit

Permalink
Add cx namelist for UKV surface (#199)
Browse files Browse the repository at this point in the history
* Add cx namelist for ukv surface

* add missing newline at end of file

* Explicitly set necessary cx fields

* Only use CxFields that JOPA can convert

* add surface ukv to netcdf generator

* Other changes needed for test
  • Loading branch information
ReubenHill authored Apr 17, 2024
1 parent f797633 commit 0844270
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 1 deletion.
46 changes: 46 additions & 0 deletions etc/ukv/cx/Surface.nl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
&CXControlNL
! All variables below are found in OPS cx outputs for surface processing. Not all are
! necessary for JOPA.
!
! Surface Variables:
! CX Index CX Index Name STASH code for here In OPS cx and required for JOPA?
! -----------------------------------------------------------------------------------------
! 1 IndexCxorog 33 Yes
! 2 IndexCxpstar 1 Yes
! 3 IndexCxt2 3236 Yes
! 4 IndexCxrh2 3245 Yes
! 5 IndexCxu10 3209 Yes
! 6 IndexCxv10 3210 Yes
! 8 IndexCxvis 3247 No
! 13 IndexCxTskinSea 24 Yes
! 16 IndexCxpmsl 16222 No
! 17 IndexCxSeaIce 31 No
! 20 IndexCxqt2 3255 No
! 21 IndexCxaerosol 90 No
! 22 IndexCxPSurfParamA 20000 No
! 23 IndexCxPSurfParamB 20001 No
! 24 IndexCxCloudAmount 9217 No
! 42 IndexCxSnowAmount 23 No
! 46 IndexCxBLheight 25 No
! 48 IndexCxLowCloudAmount 9203 No
! 49 IndexCxMedCloudAmount 9204 No
! 50 IndexCxLowCloudBase 9219 No
! 56 IndexCxObukhovLength 3464 No
! 57 IndexCxFrictionVel 3465 No
! 58 IndexCxLapseRate 20002 No
!
! Upper-air variables:
! CX Index CX Index Name STASH code for here In OPS cx and required for JOPA?
! -----------------------------------------------------------------------------------------
! 1 IndexCxtheta 4 Yes
! 3 IndexCxu 2 Yes
! 4 IndexCxv 3 Yes
! 5 IndexCxq 10 Yes
! 11 IndexCxp 407 Yes
! 29 IndexCxqcf 12 Yes
! 30 IndexCxqcl 254 Yes
! 36 IndexCxRichNumber 3208 No
! 37 IndexCxSoilMoisture 8223 No
! 38 IndexCxSoilTemp 8225 No
CxFields=33,1,3236,3245,3209,3210,24,4,2,3,10,407,12,254
/
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ ADD_WRITER_TEST(NAME cxwriter_ukvnamelist_surfacecloud
YAML cxwriter_ukvnamelist_surfacecloud.yaml
NAMELIST ../../etc/ukv/cx/SurfaceCloud.nl
DATA cx_ukvnamelist_surfacecloud.nc4 dummy.nc4)
ADD_WRITER_TEST(NAME cxwriter_ukvnamelist_surface
YAML cxwriter_ukvnamelist_surface.yaml
NAMELIST ../../etc/ukv/cx/Surface.nl
DATA cx_ukvnamelist_surface.nc4 dummy.nc4)

### Tests of auxiliary classes

Expand Down
11 changes: 10 additions & 1 deletion test/generate_unittest_netcdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def copy_var_to_var(Group, invarname, outvarname, filename):
'mass_content_of_cloud_liquid_water_in_atmosphere_layer', 'air_pressure_levels',
'cloud_volume_fraction_in_atmosphere_layer', 'liquid_cloud_volume_fraction_in_atmosphere_layer', 'ice_cloud_volume_fraction_in_atmosphere_layer'],
'testinput/cx_globalnamelist_ssmis.nc4')

# MWSFY3
output_full_cx_to_netcdf(['skin_temperature','ice_area_fraction','surface_altitude','surface_pressure','uwind_at_10m',
'vwind_at_10m','surface_temperature','relative_humidity_2m','surface_pressure_at_mean_sea_level'],
Expand Down Expand Up @@ -1024,6 +1024,15 @@ def copy_var_to_var(Group, invarname, outvarname, filename):
'eastward_wind', 'northward_wind'],
'testinput/cx_globalnamelist_surface.nc4')

# Surface - UKV
output_full_cx_to_netcdf(['skin_temperature', 'surface_altitude', 'surface_pressure', 'uwind_at_10m',
'vwind_at_10m', 'surface_temperature', 'relative_humidity_2m'],
['potential_temperature', 'specific_humidity', 'mass_content_of_cloud_ice_in_atmosphere_layer',
'mass_content_of_cloud_liquid_water_in_atmosphere_layer', 'air_pressure_levels',
'cloud_volume_fraction_in_atmosphere_layer', 'liquid_cloud_volume_fraction_in_atmosphere_layer', 'ice_cloud_volume_fraction_in_atmosphere_layer',
'eastward_wind', 'northward_wind'],
'testinput/cx_ukvnamelist_surface.nc4')

# Scatwind
output_full_cx_to_netcdf(['friction_velocity_over_water', 'ice_area_fraction', 'obukhov_length', 'relative_humidity_2m', 'skin_temperature',
'surface_altitude', 'surface_pressure', 'surface_pressure_at_mean_sea_level', 'surface_temperature',
Expand Down
Binary file added test/testinput/cx_ukvnamelist_surface.nc4
Binary file not shown.
52 changes: 52 additions & 0 deletions test/testinput/cxwriter_ukvnamelist_surface.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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/cx_ukvnamelist_surface.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: ../etc/ukv/cx
reject_obs_with_any_variable_failing_qc: true
general_mode: debug
IC_PLevels: 5
- filter: Cx Checker
expected_surface_variables: ["1","2","3","4","5","6","13"]
expected_upper_air_variables: ["1","3","4","5","11","29","30"]
expected_main_table_columns:
- # observation 3 is rejected by the tests above hence only 3 (1,2,4) columns
- ["17.10","27.10","57.10","67.10","37.10","47.10",
"7.10","1.10","1.20","1.30","81.10","81.20","81.30",
"91.10","91.20","91.30","11.10","11.20","11.30",
"41.10","41.20","41.30","21.10","21.20","21.30",
"31.10","31.20","31.30"] # column 1 - 1st observation
- ["**********","**********","**********","**********","**********","**********","**********",
"2.10","**********","2.30","82.10","**********","82.30","92.10","**********","92.30","12.10",
"**********","12.30","42.10","**********","42.30","22.10","**********","22.30","32.10","**********",
"32.30"] # column 2 - 2nd observation
- ["17.40","27.40","57.40","67.40","37.40","47.40",
"7.40","4.10","4.20","4.30","84.10","84.20","84.30",
"94.10","94.20","94.30","14.10","14.20","14.30",
"44.10","44.20","44.30","24.10","24.20","24.30",
"34.10","34.20","34.30"] # column 3 - observation 4
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

0 comments on commit 0844270

Please sign in to comment.