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.


ASCII print with ncks

  • 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

    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?


    • Charlie Zender
      Charlie Zender

      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
      and then print with ncks.


  • Zeal

    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)