Project

General

Profile

Filter NC Files by Dates of CSV. Table

Added by Gernot Fischer over 4 years ago

Hello at all,
I‘m new here and have troubles by dealing with NC files.
I have a list of 40 nc files with daily data (40x365 days) and want to filter this data by an external table (on daily base too).
The nc. data are like that:
DATE1 [year-month-day]:X,Y, values of Pixels
DATE2 [year-month-day]:X,Y, values of pixels
...

The csv looks like:
DATE [year-month-day]: value (1-7)

In the end i want a list of all
Nc files on days with one of the 7 values.
Like:

For value 1:
[1999-01-01]: x,y, pixels
[1999-01-06]: x,y, pixels

For value 2:
[1999-01-02]: x,y, pixels
And so on..

Is there a possibility to do so?

Thanks for help and informations,
greets


Replies (1)

RE: Filter NC Files by Dates of CSV. Table - Added by Ralf Mueller over 4 years ago

hi!

if you look for a certain value you can do this in multiple ways (I'd recommend to search for each value separately, btw):

  1. use cdo outputket,value | grep $VALUE where the VALUE variable holds one of the 7 values you look for. a non-zero exit code will indicate if the value is not present. BUT: you should keep in mind that numerical representations can disturb your search.
  2. you could insert a very small/big value instead of the VALUE you are looking for and let CDO compare with the original data
    cdo -diffv -setvals,$VALUE,99999999 <input file> <input file>
    A non-zero exit code indicates that the VALUE is present in your input file.

hth
ralf

    (1-1/1)