Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ush/gsincdiag_to_ioda/gsi_ncdiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1594,11 +1594,16 @@ def toIODAobs(self, OutDir, ObsBias, QCVars, TestRefs, TotalBias=False, clobber=
# outdata[(loc_mdata_name, 'MetaData')] = tmp
# if loc_mdata_name in units_values.keys():
# varAttrs[(loc_mdata_name, 'MetaData')]['units'] = units_values[loc_mdata_name]

# For SSMIS "Sat_Azimuth_Angle" actually contains the "satelliteAscendingFlag". So populate the latter and
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. This should be removed for code cleanliness.

Copilot uses AI. Check for mistakes.
# set "sensorAzimuthAngle" to zero (it needs to be defined but is not used)
elif self.sensor == "ssmis" and lvar == "Sat_Azimuth_Angle":
tmp = self.var(lvar)[::nchans].astype(np.int32)
tmp[tmp > 4e8] = self.INT_FILL
outdata[("satelliteAscendingFlag", 'MetaData')] = tmp
varAttrs[("satelliteAscendingFlag", 'MetaData')]['_FillValue'] = self.INT_FILL
outdata[("sensorAzimuthAngle", "MetaData")] = np.zeros(tmp.shape, dtype=np.float32)
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. This should be removed for code cleanliness.

Suggested change
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)

Copilot uses AI. Check for mistakes.
Comment on lines +1605 to +1606
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VarDims dictionary should be set for both new metadata variables to ensure they are properly written by the IodaWriter. Based on the pattern in this file (e.g., lines 1628, 1637, 1771, 1983), metadata variables that are manually created need to have their dimensions explicitly specified. Both satelliteAscendingFlag and sensorAzimuthAngle should have dimensions set to ['Location'] since they contain one value per observation location.

Suggested change
outdata[("sensorAzimuthAngle", "MetaData")] = np.zeros(tmp.shape, dtype=np.float32)
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
VarDims[("satelliteAscendingFlag", 'MetaData')] = ['Location']
outdata[("sensorAzimuthAngle", "MetaData")] = np.zeros(tmp.shape, dtype=np.float32)
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
VarDims[("sensorAzimuthAngle", "MetaData")] = ['Location']

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The units attribute should be set for the sensorAzimuthAngle variable. According to the units_values dictionary at line 622, sensorAzimuthAngle should have units of 'degree'. This is missing and should be added to maintain consistency with other angle metadata variables in the file.

Suggested change
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
varAttrs[("sensorAzimuthAngle", "MetaData")]["_FillValue"] = np.float32(self.FLOAT_FILL)
varAttrs[("sensorAzimuthAngle", "MetaData")]["units"] = "degree"

Copilot uses AI. Check for mistakes.
else:
if dtype == 'integer':
tmp = self.var(lvar)[::nchans].astype(np.int32)
Expand Down
Loading