You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

How do I swap (reverse) the scanning order? for example north-to-south changed to south-to-north

Step-by-step guide

Say you have a GRIB file with scanning order of south-to-north (for latitudes). This means the key "jScansPositively" is 1. You want to change this to north-to-south i.e. jScansPositively should become 0

  1. Ensure that the grid geometry of your GRIB message specifies both the latitudes: 

    latitudeOfFirstGridPointInDegrees and latitudeOfLastGridPointInDegrees

  2. Use the grib_set command to swap the scanning order for the latitudes:

    % grib_set -s swapScanningY=1  input.grib  output.grib

    This changes the order in which the data is stored in the GRIB message

There is also the key "swapScanningX" to do the same task for longitudes (east-to-west changed to west-to-east).

Note: This only works for regular lat/lon grids and regular Gaussian grids. It is not to be used for reduced grids, Lambert, Polar stereographic, Mercator etc.

Here is a way of visualising the different scanning orders:




Check the resultant file to ensure the data is shown correctly e.g., by plotting it



  • No labels