Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

ASCII print with ncks

2003-12-08
2013-10-17
  • Hi,
    I'm trying to print NetCDF parameters in the ascii format with the ncks operator. For fixed longitude and latittude, I would like to print my parameter in function of time, in 2 columns, as a simple time serie.
    My command-line looks :

    ncks -H -C -d lon,1 -d lat,45 -v time,TP TPfile.nc

    which gives nearly the great result, but without a friendly print format:

    time[0]=100056  lat[45]=-5.625 lon[1]=1.875 TP[45889]=101491.9375
    ...

    I'd like to obtain only the 2 column values for time and TP...
    Any idea?

    Thanks,
    Julien.

     
    • Charlie Zender
      Charlie Zender
      2003-12-10

      The best way to do this is to uses ncwa to average
      over the lat and lon dimensions for this particular
      point, e.g., ncwa -a lat,lon -d lat,-5.6  -d lon,1.87
      in.nc out.nc
      and then print out.nc with ncks.

      Charlie

       
  • Zeal
    Zeal
    2013-10-07

    Hi Charlie,
    I have the same problem. I have spatial averaging with 'ncwa'.
    Now, I would like to convert the data to ascii, keeping the time and temperature variables. Other information such as lat, lon, etc should be discarded.

    How can I do this suing 'ncks' such that I can read the dates and temperature values in Excel, for example?
    My resulting .txt file should have only two columns (date and temperature)

    Thanks,
    Zilefac