Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
xincjin-NOAA committed May 31, 2024
1 parent f6dbd2a commit 991333c
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 132 deletions.
96 changes: 92 additions & 4 deletions ush/ioda/bufr2ioda/bufr2ioda_ssmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,113 @@
import json
import os
from combine_base import Bufr2IodaBase
# from wxflow import Logger
from logging import Logger
from wxflow import Logger

logger = Logger(os.path.basename(__file__), level='INFO')

yaml_file = "bufr2ioda_ssmis.yaml"
config_json = {
"data_type": "ssmis",
"subsets": ["NC005044", "NC005045", "NC005046"],
"data_description": "NC005044 JMA SATWIND, AHI HIM8 IR(LW)/VIS/WV-CT/WV-CS; NC005045 JMA SATWIND, HIMAWARI-8 "
"IR(LW)/VIS/WV-CT/WV-CS; NC005046 JMA SATWIND, HIMAWARI-8 IR(LW)/VIS/WV-CT/WV-CS",
"data_provider": "JMA",
"sensor_info": {"sensor_name": "AHI", "sensor_full_name": "Advanced Himawari Imager", "sensor_id": 999},
"satellite_info": [
{"satellite_name": "GOES-16", "satellite_full_name": "Geostationary Operational Satellite - 16",
"satellite_id": 249},
{"satellite_name": "GOES-17", "satellite_full_name": "Geostationary Operational Satellite - 17",
"satellite_id": 285},
{"satellite_name": "GOES-18", "satellite_full_name": "Geostationary Operational Satellite - 18",
"satellite_id": 286},
{"satellite_name": "GOES-18", "satellite_full_name": "Geostationary Operational Satellite - 18",
"satellite_id": 287}
],
"yaml_file": yaml_file
}

ssmis_yaml = {
'bufr': {
# obsdatain: "{{ DMPDIR }}/{{ RUN }}.{{ PDY }}/{{ cyc }}/atmos/{{ RUN }}.t{{ cyc }}z.esamua.tm00.bufr_d"

'obsdatain': '/scratch2/NCEPDEV/stmp3/Xin.C.Jin/bufr2ioda/from_orion/gdas.t00z.ssmisu.tm00.bufr_d',
'splits': {'satId': {'category': {'map': {'_249': 'f16',
'_285': 'f17',
'_286': 'f18',
'_287': 'f19'},
'variable': 'satelliteIdentifier'}}},
'variables': {
'fieldOfViewNumber': {'query': '*/FOVN'},
'latitude': {'query': '*/CLAT'},
'longitude': {'query': '*/CLON'},
'orbitNumber': {'query': '*/ORBN'},
'rainFlag': {'query': '*/RFLAG'},
'remappedBT': {'remappedBrightnessTemperature': {'brightnessTemperature': '*/SSMISCHN/TMBR',
'fieldOfViewNumber': '*/FOVN',
'obsTime': {'day': '*/DAYS',
'hour': '*/HOUR',
'minute': '*/MINU',
'month': '*/MNTH',
'second': '*/SECO',
'year': '*/YEAR'},
'sensorChannelNumber': '*/SSMISCHN/CHNM'}},
'satelliteIdentifier': {'query': '*/SAID'},
'scanLineNumber': {'query': '*/SLNM'},
'sensorChannelNumber': {'query': '*/SSMISCHN/CHNM'},
'surfaceFlag': {'query': '*/SFLG'}
}},
'encoder': {
'dimensions': [{'name': 'Channel',
'path': '*/SSMISCHN',
'source': 'variables/sensorChannelNumber'}],
'globals': [{'name': 'platformCommonName',
'type': 'string',
'value': 'SSMIS'},
{'name': 'platformLongDescription',
'type': 'string',
'value': 'MTYP 021-203 SSMIS ATENNA/BRIGHTNESS '
'TEMPERATURE DATA'}],
# obsdataout: "{{ COM_OBS }}/{{ RUN }}.t{{ cyc }}z.esamua.$(splitvar).tm00.nc"
'obsdataout': 'temporary_{splits/satId}_1716389684.nc',
'variables': [{'longName': 'Satellite Identifier',
'name': 'MetaData/satelliteIdentifier',
'source': 'variables/satelliteIdentifier'},
{'longName': 'Sensor Channel Number',
'name': 'MetaData/sensorChannelNumber',
'source': 'variables/sensorChannelNumber'},
{'chunks': [10000, 22],
'longName': '3-by-3 Averaged Brightness '
'Temperature',
'name': 'ObsValue/brightnessTemperature',
'source': 'variables/remappedBT',
'units': 'K'}]}}

# This will be moved out in the future. it should be an input when call this program.
config = {
'RUN': 123,
'current_cycle': '2022010412',
'DATA': 'abcd',
'DMPDIR': 'abc',
'COM_OBS': 'abs',
'PDY': '20220104',
'cyc': '12',
}


class Bufr2IodaSsmis(Bufr2IodaBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.update_config(config_json)
self.yaml_config = ssmis_yaml


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', type=str, help='Input JSON configuration', required=True)
parser.add_argument('-v', '--verbose', help='print debug logging information',
action='store_true')
args = parser.parse_args()
log_level = 'DEBUG' if args.verbose else 'INFO'
logger = Logger(os.path.basename(__file__), level=log_level)
converter = Bufr2IodaSsmis(args.config)
converter = Bufr2IodaSsmis(config)
converter.execute()
logger.info('--Finished--')
185 changes: 79 additions & 106 deletions ush/ioda/bufr2ioda/bufr2ioda_ssmis.yaml
Original file line number Diff line number Diff line change
@@ -1,120 +1,93 @@

bufr:
obsdatain: "/scratch2/NCEPDEV/stmp3/Xin.C.Jin/bufr2ioda/from_orion/gdas.t00z.ssmisu.tm00.bufr_d"
variables:
# MetaData
timestamp:
datetime:
year: "*/YEAR"
month: "*/MNTH"
day: "*/DAYS"
hour: "*/HOUR"
minute: "*/MINU"
second: "*/SECO"

latitude:
query: "*/CLAT"

longitude:
query: "*/CLON"

satelliteIdentifier:
query: "*/SAID"

scanLineNumber:
query: "*/SLNM"

# The type should be integer.
# However, UFO/CRTM requred this variable to be float
fieldOfViewNumber:
query: "*/FOVN"
# type: float

surfaceFlag:
query: "*/SFLG"

rainFlag:
query: "*/RFLAG"

orbitNumber:
query: "*/ORBN"

sensorChannelNumber:
query: '*/SSMISCHN/CHNM'

# ObsValue
# Remapped Brightness Temperature
remappedBT:
remappedBrightnessTemperature:
fieldOfViewNumber: "*/FOVN"
sensorChannelNumber: "*/SSMISCHN/CHNM"
brightnessTemperature: "*/SSMISCHN/TMBR"
obsTime:
year: "*/YEAR"
month: "*/MNTH"
day: "*/DAYS"
hour: "*/HOUR"
minute: "*/MINU"
second: "*/SECO"

obsdatain: /scratch2/NCEPDEV/stmp3/Xin.C.Jin/bufr2ioda/from_orion/gdas.t00z.ssmisu.tm00.bufr_d
splits:
satId:
category:
variable: satelliteIdentifier
map:
_249: f16
_285: f17
_286: f18
_287: f19

variable: satelliteIdentifier
variables:
fieldOfViewNumber:
query: '*/FOVN'
latitude:
query: '*/CLAT'
longitude:
query: '*/CLON'
orbitNumber:
query: '*/ORBN'
rainFlag:
query: '*/RFLAG'
remappedBT:
remappedBrightnessTemperature:
brightnessTemperature: '*/SSMISCHN/TMBR'
fieldOfViewNumber: '*/FOVN'
obsTime:
day: '*/DAYS'
hour: '*/HOUR'
minute: '*/MINU'
month: '*/MNTH'
second: '*/SECO'
year: '*/YEAR'
sensorChannelNumber: '*/SSMISCHN/CHNM'
satelliteIdentifier:
query: '*/SAID'
scanLineNumber:
query: '*/SLNM'
sensorChannelNumber:
query: '*/SSMISCHN/CHNM'
surfaceFlag:
query: '*/SFLG'
timestamp:
datetime:
day: '*/DAYS'
hour: '*/HOUR'
minute: '*/MINU'
month: '*/MNTH'
second: '*/SECO'
year: '*/YEAR'
encoder:
backend: netcdf
obsdataout: "temporary_{splits/satId}_1716389684.nc"

dimensions:
- name: Channel
source: variables/sensorChannelNumber
path: "*/SSMISCHN"

- name: Channel
path: '*/SSMISCHN'
source: variables/sensorChannelNumber
globals:
- name: "platformCommonName"
type: string
value: "SSMIS"

- name: "platformLongDescription"
type: string
value: "MTYP 021-203 SSMIS ATENNA/BRIGHTNESS TEMPERATURE DATA"

- name: platformCommonName
type: string
value: SSMIS
- name: platformLongDescription
type: string
value: MTYP 021-203 SSMIS ATENNA/BRIGHTNESS TEMPERATURE DATA
obsdataout: temporary_{splits/satId}_1716389684.nc
variables:
# MetaData
- name: "MetaData/dateTime"
source: variables/timestamp
longName: "Datetime"
units: "seconds since 1970-01-01T00:00:00Z"

- name: "MetaData/latitude"
source: variables/latitude
longName: "Latitude"
units: "degree_north"
range: [-90, 90]

- name: "MetaData/longitude"
source: variables/longitude
longName: "Longitude"
units: "degree_east"

- name: "MetaData/satelliteIdentifier"
source: variables/satelliteIdentifier
longName: "Satellite Identifier"

- name: "MetaData/sensorChannelNumber"
source: variables/sensorChannelNumber
longName: "Sensor Channel Number"

# ObsValue
# Remapped Brightness Temperature
- name: "ObsValue/brightnessTemperature"
source: variables/remappedBT
longName: "3-by-3 Averaged Brightness Temperature"
units: "K"
chunks: [10000, 22]
- 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
- longName: Satellite Identifier
name: MetaData/satelliteIdentifier
source: variables/satelliteIdentifier
- longName: Sensor Channel Number
name: MetaData/sensorChannelNumber
source: variables/sensorChannelNumber
- chunks:
- 10000
- 22
longName: 3-by-3 Averaged Brightness Temperature
name: ObsValue/brightnessTemperature
source: variables/remappedBT
units: K
Loading

0 comments on commit 991333c

Please sign in to comment.