Project

General

Profile

replace data values from gribA to gribB

Added by Christophe LOZAC'H 12 months ago

Hello,

I wish to iterate over all the lat lon points of two GRIB files, A and B. These points are identified by their index numbers, ranging from 0 to lastIndex. Using an index mapping file, for example, where index a in GRIB A corresponds to index b in GRIB B, I want to replace the data values in GRIB A with those in GRIB B. The two GRIB files do not have the same number of indices, but all indices have a correspondence. Is it possible?

Many thanks


Replies (2)

RE: replace data values from gribA to gribB - Added by Ralf Mueller 11 months ago

Hi Christophe!

With CDO you can apply masks or perform calculation of masked regions. This might work for you (operators: ifthen, gt, lt). With the two files upload I might be able to help in a better way.

if you know the correct index set, you might be able to use xarray, too

cheers
ralf

RE: replace data values from gribA to gribB - Added by Christophe LOZAC'H 11 months ago

Thank you for your help. Attached are a gribA file and a gribB file, along with the index mapping file between A and B. It is also possible to propose a function for converting one index to another, which would be more elegant.

files.7z (1.4 MB) files.7z
    (1-2/2)