From 05d81bcefd6e61cb905d6c14bd9d392eeaa3384a Mon Sep 17 00:00:00 2001 From: xincjin-NOAA Date: Wed, 5 Jun 2024 16:31:18 +0000 Subject: [PATCH] a working version --- .../bufr2ioda/bufr2ioda_ncep_1bamua_ta.yaml | 34 +++++++++---------- ush/ioda/bufr2ioda/bufr2ioda_ncep_esamua.yaml | 34 +++++++++---------- ush/ioda/bufr2ioda/bufr2ioda_ssmis.py | 18 ++++++---- ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml | 5 +++ ush/ioda/bufr2ioda/combine_base.py | 4 +-- ush/ioda/bufr2ioda/run_bufr_converter.py | 8 +++-- 6 files changed, 56 insertions(+), 47 deletions(-) diff --git a/ush/ioda/bufr2ioda/bufr2ioda_ncep_1bamua_ta.yaml b/ush/ioda/bufr2ioda/bufr2ioda_ncep_1bamua_ta.yaml index 18a622d56..2739798d4 100644 --- a/ush/ioda/bufr2ioda/bufr2ioda_ncep_1bamua_ta.yaml +++ b/ush/ioda/bufr2ioda/bufr2ioda_ncep_1bamua_ta.yaml @@ -45,6 +45,7 @@ bufr: hour: '*/HOUR' minute: '*/MINU' month: '*/MNTH' + second: '*/SECO' year: '*/YEAR' encoder: backend: netcdf @@ -61,24 +62,6 @@ encoder: value: MTYP 021-023 PROC AMSU-A 1B Tb obsdataout: temporary_ta_{splits/satId}_1716389684.nc variables: - - longName: Datetime - name: MetaData/dateTime - source: variables/timestamp - units: seconds since 1970-01-01T00:00:00Z - - longName: Latitude - name: MetaData/latitude - range: - - -90 - - 90 - source: variables/latitude - units: degree_north - - longName: Longitude - name: MetaData/longitude - range: - - -180 - - 180 - source: variables/longitude - units: degree_east - longName: Satellite Identifier name: MetaData/satelliteIdentifier source: variables/satelliteIdentifier @@ -135,3 +118,18 @@ encoder: - 380 source: variables/brightnessTemperature units: K + - longName: Datetime + name: MetaData/dateTime + source: variables/timestamp + units: seconds since 1970-01-01T00:00:00Z + - longName: Latitude + name: MetaData/latitude + range: + - -90 + - 90 + source: variables/latitude + units: degree_north + - longName: Longitude + name: MetaData/longitude + source: variables/longitude + units: degree_east diff --git a/ush/ioda/bufr2ioda/bufr2ioda_ncep_esamua.yaml b/ush/ioda/bufr2ioda/bufr2ioda_ncep_esamua.yaml index 4c07d3637..f0983d777 100644 --- a/ush/ioda/bufr2ioda/bufr2ioda_ncep_esamua.yaml +++ b/ush/ioda/bufr2ioda/bufr2ioda_ncep_esamua.yaml @@ -45,6 +45,7 @@ bufr: hour: '*/HOUR' minute: '*/MINU' month: '*/MNTH' + second: '*/SECO' year: '*/YEAR' encoder: backend: netcdf @@ -61,24 +62,6 @@ encoder: value: MTYP 021-033 RARS(EARS,AP,SA) AMSU-A 1C Tb DATA) obsdataout: temporary_es_{splits/satId}_1716389684.nc variables: - - longName: Datetime - name: MetaData/dateTime - source: variables/timestamp - units: seconds since 1970-01-01T00:00:00Z - - longName: Latitude - name: MetaData/latitude - range: - - -90 - - 90 - source: variables/latitude - units: degree_north - - longName: Longitude - name: MetaData/longitude - range: - - -180 - - 180 - source: variables/longitude - units: degree_east - longName: Satellite Identifier name: MetaData/satelliteIdentifier source: variables/satelliteIdentifier @@ -136,3 +119,18 @@ encoder: - 500 source: variables/brightnessTemperature units: K + - longName: Datetime + name: MetaData/dateTime + source: variables/timestamp + units: seconds since 1970-01-01T00:00:00Z + - longName: Latitude + name: MetaData/latitude + range: + - -90 + - 90 + source: variables/latitude + units: degree_north + - longName: Longitude + name: MetaData/longitude + source: variables/longitude + units: degree_east diff --git a/ush/ioda/bufr2ioda/bufr2ioda_ssmis.py b/ush/ioda/bufr2ioda/bufr2ioda_ssmis.py index b2985aa05..18204dac4 100644 --- a/ush/ioda/bufr2ioda/bufr2ioda_ssmis.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_ssmis.py @@ -45,6 +45,7 @@ 'longitude': {'query': '*/CLON'}, 'orbitNumber': {'query': '*/ORBN'}, 'rainFlag': {'query': '*/RFLAG'}, + 'scanAngle': {'query': '*/SCLINGEO/RAIA'}, 'remappedBT': {'remappedBrightnessTemperature': {'brightnessTemperature': '*/SSMISCHN/TMBR', 'fieldOfViewNumber': '*/FOVN', 'obsTime': {'day': '*/DAYS', @@ -78,6 +79,9 @@ {'longName': 'Sensor Channel Number', 'name': 'MetaData/sensorChannelNumber', 'source': 'variables/sensorChannelNumber'}, + {'longName': 'Sensor Scan Angle', + 'name': 'MetaData/sensorScanAngle', + 'source': 'variables/scanAngle'}, {'chunks': [10000, 22], 'longName': '3-by-3 Averaged Brightness ' 'Temperature', @@ -94,13 +98,13 @@ def __init__(self, *args, **kwargs): self.update_config(config_json) self.yaml_config = ssmis_yaml - def re_map_variable(self): - - for sat_id in self.sat_ids: - logger.info(f'Converting for {sat_id}, ...') - ta = self.get_container_variable('variables', 'brightnessTemperature', sat_id) - tb = self.apply_corr(ta) - self.replace_container_variable('variables', 'brightnessTemperature', tb, sat_id) + # def re_map_variable(self): + # + # for sat_id in self.sat_ids: + # logger.info(f'Converting for {sat_id}, ...') + # ta = self.get_container_variable('variables', 'brightnessTemperature', sat_id) + # tb = self.apply_corr(ta) + # self.replace_container_variable('variables', 'brightnessTemperature', tb, sat_id) def apply_corr(self, ta): ta = ta * 100 diff --git a/ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml b/ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml index 160037d17..01ae074ea 100644 --- a/ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml +++ b/ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml @@ -20,6 +20,8 @@ bufr: query: '*/ORBN' rainFlag: query: '*/RFLAG' + scanAngle: + query: '*/SCLINGEO/RAIA' remappedBT: remappedBrightnessTemperature: brightnessTemperature: '*/SSMISCHN/TMBR' @@ -68,6 +70,9 @@ encoder: - longName: Sensor Channel Number name: MetaData/sensorChannelNumber source: variables/sensorChannelNumber + - longName: Sensor Scan Angle + name: MetaData/sensorScanAngle + source: variables/scanAngle - chunks: - 10000 - 22 diff --git a/ush/ioda/bufr2ioda/combine_base.py b/ush/ioda/bufr2ioda/combine_base.py index aa5b375d3..97941e123 100644 --- a/ush/ioda/bufr2ioda/combine_base.py +++ b/ush/ioda/bufr2ioda/combine_base.py @@ -83,8 +83,8 @@ def get_container_variable(self, group, variable, sat_id): def replace_container_variable(self, group, variable, var, sat_id): self.container.replace(group + '/' + variable, var, [sat_id, ]) - def add_container_variable(self, group, variable, var, sat_id): - self.container.replace(group + '/' + variable, var, [sat_id, ]) + def add_container_variable(self, group, variable, var, path, sat_id): + self.container.replace(group + '/' + variable, var, path, [sat_id, ]) def get_yaml_file(self): return self.config['yaml_file'] diff --git a/ush/ioda/bufr2ioda/run_bufr_converter.py b/ush/ioda/bufr2ioda/run_bufr_converter.py index 712b5dfc3..2dfff38e0 100644 --- a/ush/ioda/bufr2ioda/run_bufr_converter.py +++ b/ush/ioda/bufr2ioda/run_bufr_converter.py @@ -2,12 +2,16 @@ from wxflow import Logger, parse_j2yaml, cast_strdict_as_dtypedict from bufr2ioda_ssmis import Bufr2IodaSsmis +from bufr2ioda_ncep_1bmusa import Bufr2IodaAmusa +from bufr2ioda_ncep_esamua import Bufr2IodaEsamusa # Initialize root logger logger = Logger('gen_bufr2ioda_json.py', level='INFO', colored_log=True) bufr_classes = [ - Bufr2IodaSsmis, +# Bufr2IodaSsmis, + Bufr2IodaAmusa, + Bufr2IodaEsamusa, ] config = { @@ -22,7 +26,7 @@ if __name__ == "__main__": - + #TODO mp for bufr_class in bufr_classes: converter = bufr_class(config) converter.execute()