diff --git a/dump/config/atmosphere/prepbufr_aircraft.yaml b/dump/config/atmosphere/prepbufr_aircraft.yaml index a35e78d..717460b 100755 --- a/dump/config/atmosphere/prepbufr_aircraft.yaml +++ b/dump/config/atmosphere/prepbufr_aircraft.yaml @@ -47,7 +47,7 @@ bufr: query: "*/PRSLEVLA/DRFTINFO/YDR" obsTimeMinusCycleTime: query: "*/PRSLEVLA/DRFTINFO/HRDR" - heightOfStationMetaData: #Formerly aircraftFlightLevel + heightMetaData: #Formerly aircraftFlightLevel query: "*/PRSLEVLA/Z___INFO/Z__EVENT{1}/ZOB" stationElevationMetaData: query: "*/ELV" @@ -196,8 +196,8 @@ encoder: longName: "Pressure" units: "Pa" - - name: "MetaData/heightOfStation" - source: variables/heightOfStationMetaData + - name: "MetaData/height" + source: variables/heightMetaData longName: "Height Of Station" units: "m" diff --git a/dump/scripts/atmosphere/prepbufr_aircraft.py b/dump/scripts/atmosphere/prepbufr_aircraft.py index ccc95ff..7566c8b 100755 --- a/dump/scripts/atmosphere/prepbufr_aircraft.py +++ b/dump/scripts/atmosphere/prepbufr_aircraft.py @@ -72,6 +72,14 @@ def make_obs(self, comm, input_path): sequenceNum = self._compute_sequence_number(lon) self.log.debug(f'sequenceNum min/max = {sequenceNum.min()} {sequenceNum.max()}') + self.log.debug(f'Change IALR to 0.0 based on masking and ObsType') + orig_ot = container.get('airTemperatureObservationType') + ialr = container.get('instantaneousAltitudeRate') + ialr_paths = container.get_paths('instantaneousAltitudeRate') + ialr2 = ma.array(ialr) + + ialr_bc = self._compute_ialr_if_masked(orig_ot, ialr2) + self.log.debug(f'Compute Obstypes') t_ot = container.get('airTemperatureObservationType') q_ot = container.get('specificHumidityObservationType') @@ -86,13 +94,6 @@ def make_obs(self, comm, input_path): ot_specificHumidity = self._compute_typ_other(q_ot, specificHumidity) ot_wind = self._compute_typ_uv(uv_ot, wind) - self.log.debug(f'Change IALR to 0.0 if masked for bias correction.') - ialr = container.get('instantaneousAltitudeRate') - ialr_paths = container.get_paths('instantaneousAltitudeRate') - ialr2 = ma.array(ialr) - - ialr_bc = self._compute_ialr_if_masked(uv_ot, ialr2) - self.log.debug(f'Update variables in container') container.replace('instantaneousAltitudeRate', ialr_bc) container.replace('airTemperatureObservationType', ot_airTemperature) @@ -151,8 +152,13 @@ def _compute_ialr_if_masked(self, typ, ialr): Masked array of the updated instantaneousAltitudeRate """ - ialr_bc = copy.deepcopy(ialr) - ialr_bc[(ialr_bc.mask) & (typ >= 330) & (typ < 340)] = 0.0 + + ialr_bc = ialr.copy() + + cond = ialr_bc.mask & (typ >= 330) & (typ < 340) + + ialr_bc.data[cond] = 0.0 + ialr_bc.mask[cond] = False return ialr_bc