Skip to content

Commit

Permalink
Review changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Apr 18, 2024
1 parent 6a2220b commit 3cb16bb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
2 changes: 0 additions & 2 deletions iris_grib/_load_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,6 @@ def grid_definition_template_12(section, metadata):
lat = section["latitudeOfReferencePoint"] * _GRID_ACCURACY_IN_DEGREES
lon = section["longitudeOfReferencePoint"] * _GRID_ACCURACY_IN_DEGREES
scale = section["scaleFactorAtReferencePoint"]
# Catch bug in ECMWF GRIB API (present at 1.12.1) where the scale
# is treated as a signed, 4-byte integer.
CM_TO_M = 0.01
easting = section["XR"] * CM_TO_M
northing = section["YR"] * CM_TO_M
Expand Down
8 changes: 0 additions & 8 deletions iris_grib/_save_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,6 @@ def grid_definition_template_12(cube, grib):
eccodes.codes_set(grib, "Di", abs(x_step))
eccodes.codes_set(grib, "Dj", abs(y_step))
horizontal_grid_common(cube, grib)

# GRIBAPI expects unsigned ints in X1, X2, Y1, Y2 but it should accept
# signed ints, so work around this.
# See https://software.ecmwf.int/issues/browse/SUP-1101
eccodes.codes_set(grib, "Y1", int(y_cm[0]))
eccodes.codes_set(grib, "Y2", int(y_cm[-1]))
eccodes.codes_set(grib, "X1", int(x_cm[0]))
Expand All @@ -544,10 +540,6 @@ def m_to_cm(value):
# False easting and false northing are measured in units of (10^-2)m.
eccodes.codes_set(grib, "XR", m_to_cm(cs.false_easting))
eccodes.codes_set(grib, "YR", m_to_cm(cs.false_northing))

# GRIBAPI expects a signed int for scaleFactorAtReferencePoint
# but it should accept a float, so work around this.
# See https://software.ecmwf.int/issues/browse/SUP-1100
value = cs.scale_factor_at_central_meridian
eccodes.codes_set(grib, "scaleFactorAtReferencePoint", value)

Expand Down

0 comments on commit 3cb16bb

Please sign in to comment.