From 69d45fe2fb284e1094b5ba5f16296637b3a26675 Mon Sep 17 00:00:00 2001 From: gmao-jjin3 Date: Thu, 1 Sep 2022 17:46:29 -0400 Subject: [PATCH 1/5] Add variable for GNSS bending angle data, save orginal GSI QC flags and other corrections, and remove VarMetaData. --- src/gsi-ncdiag/gsi_ncdiag.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/gsi-ncdiag/gsi_ncdiag.py b/src/gsi-ncdiag/gsi_ncdiag.py index 5f5d57bca..74d8dee4e 100644 --- a/src/gsi-ncdiag/gsi_ncdiag.py +++ b/src/gsi-ncdiag/gsi_ncdiag.py @@ -84,6 +84,16 @@ all_LocKeyList = { 'Station_ID': ('station_id', 'string'), 'Time': ('datetime', 'string'), + 'time': ('time', 'string'), + 'ascending_flag': ('ascending_flag', 'string'), + 'earth_radius_of_curvature': ('earth_radius_of_curvature', 'string'), + 'reference_sat_id': ('reference_sat_id', 'string'), + 'occulting_sat_id': ('occulting_sat_id', 'string'), + 'record_number': ('record_number', 'string'), + 'geoid_height_above_reference_ellipsoid': ('geoid_height_above_reference_ellipsoid', 'string'), + 'gnss_sat_class': ('gnss_sat_class', 'string'), + 'impact_height': ('impact_height', 'string'), + 'impact_parameter': ('impact_parameter', 'string'), 'Latitude': ('latitude', 'float'), 'Longitude': ('longitude', 'float'), 'Station_Elevation': ('station_elevation', 'float'), @@ -115,6 +125,7 @@ 'SCCF_chan_wavelen': ('channel_wavelength', 'float'), 'QI_with_FC': ('satwind_quality_ind_with_fc', 'float'), 'QI_without_FC': ('satwind_quality_ind_no_fc', 'float'), + 'Data_Vertical_Velocity': ('data_vertical_velocity', 'float'), 'LaunchTime': ('LaunchTime', 'float'), } @@ -304,6 +315,7 @@ 'specific_humidity': 'specific_humidity', 'northward_wind': 'northward_wind', 'eastward_wind': 'eastward_wind', + 'geopotential_height_levels': 'geopotential_height_levels', 'geopotential_height': 'geopotential_height', 'geometric_height': 'geometric_height', 'height': 'height_above_mean_sea_level', @@ -315,6 +327,7 @@ 'surface_roughness': 'surface_roughness_length', 'surface_height': 'surface_geopotential_height', 'surface_geopotential_height': 'surface_geopotential_height', + 'surface_altitude': 'surface_altitude', 'surface_geometric_height': 'surface_geometric_height', 'landmask': 'land_area_fraction', 'air_temperature': 'air_temperature', @@ -349,7 +362,7 @@ 'Lai': 'leaf_area_index', 'Soil_Moisture': 'volume_fraction_of_condensed_water_in_soil', 'Soil_Temperature': 'soil_temperature', - 'Land_Type_Index': 'land_type_index', + 'Land_Type_Index': 'land_type_index_NPOESS', 'Vegetation_Type': 'vegetation_type_index', 'Soil_Type': 'soil_type', 'Snow_Depth': 'surface_snow_thickness', @@ -411,12 +424,18 @@ 'northward_wind': 'm s-1', 'eastward_wind': 'm s-1', 'geopotential_height': 'm', + 'geopotential_height_levels': 'm', 'height_above_mean_sea_level': 'm', 'surface_pressure': 'Pa', 'sea_surface_temperature': 'K', 'surface_temperature': 'K', 'surface_roughness_length': 'm', 'surface_geopotential_height': 'm', + 'surface_altitude': 'm', + 'geoid_height_above_reference_ellipsoid': 'Meters', + 'earth_radius_of_curvature': 'Meters', + 'impact_height': 'Meters', + 'impact_parameter': 'Meters', 'land_area_fraction': '1', 'air_temperature': 'K', 'air_pressure': 'Pa', @@ -448,7 +467,7 @@ 'leaf_area_index': '1', 'volume_fraction_of_condensed_water_in_soil': '1', 'soil_temperature': 'K', - 'land_type_index': '1', + 'land_type_index_NPOESS': '1', 'vegetation_type_index': '1', 'soil_type': '1', 'surface_snow_thickness': 'm', @@ -494,6 +513,7 @@ 'clw_retrieved_from_background': 'kg/m/m', 'scat_retrieved_from_observation': '1', 'LaunchTime': 'hours', + 'bending_angle': 'radians', } # @TestReference @@ -681,7 +701,8 @@ def toGeovals(self, OutDir, clobber=True): if (len(var.dimensions) == 1): dims = ("nlocs",) else: - if vname == "atmosphere_pressure_coordinate_interface": + if (vname == "atmosphere_pressure_coordinate_interface" \ + or vname == "geopotential_height_levels"): dims = ("nlocs", "ninterfaces") else: dims = ("nlocs", "nlevs") @@ -847,7 +868,7 @@ def toIODAobs(self, OutDir, clobber=True, platforms=None): tmp = self.var(lvar)[idx] StationIDs = [bytes((b''.join(tmp[a])).decode('iso-8859-1').encode('utf8')) for a in range(len(tmp))] outdata[(loc_mdata_name, 'MetaData')] = np.array(StationIDs, dtype=object) - elif lvar == 'Time': # need to process into time stamp strings #"%Y-%m-%dT%H:%M:%SZ" + elif lvar == 'Time' or lvar == 'time': # need to process into time stamp strings #"%Y-%m-%dT%H:%M:%SZ" tmp = self.var(lvar)[idx] obstimes = [self.validtime + dt.timedelta(hours=float(tmp[a])) for a in range(len(tmp))] obstimes = [a.strftime("%Y-%m-%dT%H:%M:%SZ") for a in obstimes] @@ -1362,7 +1383,8 @@ def toIODAobs(self, OutDir, ObsBias, QCVars, TestRefs, clobber=True): gsiqcname = value, 'GsiEffectiveQC' errname = value, 'GsiFinalObsError' gsiqc = np.zeros_like(outdata[varDict[value]['valKey']]) - gsiqc[outdata[errname] > 1e8] = 1 + # keep original QC. + gsiqc = np.reshape(self.var('QC_Flag'), (nlocs, nchans)) gsiqc[np.reshape(self.var('QC_Flag'), (nlocs, nchans)) < 0] = 1 outdata[gsiqcname] = gsiqc.astype(np.int32) varAttrs[gsiqcname]['units'] = 'unitless' From 0fc5e186a06004df4304d44bd8797e3f05ef57bd Mon Sep 17 00:00:00 2001 From: gmao-jjin3 Date: Fri, 2 Sep 2022 22:24:27 -0400 Subject: [PATCH 2/5] Removed the change of 'GsiEffectiveQC'. --- src/gsi-ncdiag/gsi_ncdiag.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gsi-ncdiag/gsi_ncdiag.py b/src/gsi-ncdiag/gsi_ncdiag.py index 74d8dee4e..6e2b2065e 100644 --- a/src/gsi-ncdiag/gsi_ncdiag.py +++ b/src/gsi-ncdiag/gsi_ncdiag.py @@ -1383,8 +1383,7 @@ def toIODAobs(self, OutDir, ObsBias, QCVars, TestRefs, clobber=True): gsiqcname = value, 'GsiEffectiveQC' errname = value, 'GsiFinalObsError' gsiqc = np.zeros_like(outdata[varDict[value]['valKey']]) - # keep original QC. - gsiqc = np.reshape(self.var('QC_Flag'), (nlocs, nchans)) + gsiqc[outdata[errname] > 1e8] = 1 gsiqc[np.reshape(self.var('QC_Flag'), (nlocs, nchans)) < 0] = 1 outdata[gsiqcname] = gsiqc.astype(np.int32) varAttrs[gsiqcname]['units'] = 'unitless' From 50fd58f11328ab50923c5de1b02356257bfb819b Mon Sep 17 00:00:00 2001 From: gmao-jjin3 Date: Tue, 6 Sep 2022 13:44:29 -0400 Subject: [PATCH 3/5] Trigger a test. From 6fd157cb7e2cba35640cbe730229b77a089c2784 Mon Sep 17 00:00:00 2001 From: gmao-jjin3 Date: Tue, 6 Sep 2022 19:57:40 -0400 Subject: [PATCH 4/5] Fixed coding norms. --- src/gsi-ncdiag/gsi_ncdiag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsi-ncdiag/gsi_ncdiag.py b/src/gsi-ncdiag/gsi_ncdiag.py index 6e2b2065e..d2aa27a35 100644 --- a/src/gsi-ncdiag/gsi_ncdiag.py +++ b/src/gsi-ncdiag/gsi_ncdiag.py @@ -701,8 +701,8 @@ def toGeovals(self, OutDir, clobber=True): if (len(var.dimensions) == 1): dims = ("nlocs",) else: - if (vname == "atmosphere_pressure_coordinate_interface" \ - or vname == "geopotential_height_levels"): + if (vname == "atmosphere_pressure_coordinate_interface" ) or ( + vname == "geopotential_height_levels"): dims = ("nlocs", "ninterfaces") else: dims = ("nlocs", "nlevs") From 1eadd778df19bb9fd1a97cc8777e0ceede497495 Mon Sep 17 00:00:00 2001 From: gmao-jjin3 Date: Tue, 6 Sep 2022 20:36:24 -0400 Subject: [PATCH 5/5] Fixed coding norms. Again --- src/gsi-ncdiag/gsi_ncdiag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsi-ncdiag/gsi_ncdiag.py b/src/gsi-ncdiag/gsi_ncdiag.py index d2aa27a35..8eeaf86da 100644 --- a/src/gsi-ncdiag/gsi_ncdiag.py +++ b/src/gsi-ncdiag/gsi_ncdiag.py @@ -701,8 +701,8 @@ def toGeovals(self, OutDir, clobber=True): if (len(var.dimensions) == 1): dims = ("nlocs",) else: - if (vname == "atmosphere_pressure_coordinate_interface" ) or ( - vname == "geopotential_height_levels"): + if (vname == "atmosphere_pressure_coordinate_interface") or ( + vname == "geopotential_height_levels"): dims = ("nlocs", "ninterfaces") else: dims = ("nlocs", "nlevs")