Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Problem using ncks

Developers
2011-05-10
2013-10-17
  • Hello

    The command
    ncks -O -d time,1900-1-1,1999-12-31
    on this file
    http://www.fileswap.com/dl/YGhS42VE/lixo.nc.gz.html
    does not extract January as first month but April. However,
    cdo seldate,19000101,19991231
    extracts it correctly.
    Can you reproduce this behaviour?
    Best regards.
    Eduardo

    PS netCDF library version : 4.1.1 of May 26 2010 17:07:22       

     
  • Charlie Zender
    Charlie Zender
    2011-05-10

    following are my results with NCO 4.0.8.
    I have no idea what month the time coordinate resolves to for

    time=693150.5 days since 0000-01-01 00:00:00

    is there a problem?

    zender@roulee:~$ ncks -O -C -v time -d time,1900-1-1,1999-12-31 lixo.nc | more
    time: type NC_DOUBLE, 1 dimension, 6 attributes, chunked? no, compressed? no, packed? no, ID = 0
    time RAM size is 1560*sizeof(NC_DOUBLE) = 1560*8 = 12480 bytes
    time dimension 0: time, size = 1560 NC_DOUBLE, dim. ID = 0 (CRD)(REC)
    time attribute 0: long_name, size = 4 NC_CHAR, value = time
    time attribute 1: standard_name, size = 4 NC_CHAR, value = time
    time attribute 2: axis, size = 1 NC_CHAR, value = T
    time attribute 3: units, size = 30 NC_CHAR, value = days since 0000-01-01 00:00:00
    time attribute 4: calendar, size = 6 NC_CHAR, value = noleap
    time attribute 5: bounds, size = 9 NC_CHAR, value = time_bnds

    time=693150.5 days since 0000-01-01 00:00:00
    time=693180 days since 0000-01-01 00:00:00
    time=693209.5 days since 0000-01-01 00:00:00
    time=693240 days since 0000-01-01 00:00:00
    time=693270.5 days since 0000-01-01 00:00:00

     
  • Charlie Zender
    Charlie Zender
    2011-05-10

    p.s. note that NCO 4.0.8 fixed a bug with "noleap" calendars.

     
  • Hello
    Thank you for your answer. Using the same command I got a different result. The first time is now 693605 days since 0000-01-01 00:00:00. Shall I install a new NCO version? What do you suggest?
    Regards
    Eduardo

    + ncks -O -C -v time -d time,1900-1-1,1999-12-31 lixo.nc
    + more
    time: type NC_DOUBLE, 1 dimension, 6 attributes, chunked? no, compressed? no, packed? no, ID = 0
    time RAM size is 1560*sizeof(NC_DOUBLE) = 1560*8 = 12480 bytes
    time dimension 0: time, size = 1560 NC_DOUBLE, dim. ID = 0 (CRD)(REC)
    time attribute 0: long_name, size = 4 NC_CHAR, value = time
    time attribute 1: standard_name, size = 4 NC_CHAR, value = time
    time attribute 2: axis, size = 1 NC_CHAR, value = T
    time attribute 3: units, size = 30 NC_CHAR, value = days since 0000-01-01 00:00:00
    time attribute 4: calendar, size = 6 NC_CHAR, value = noleap
    time attribute 5: bounds, size = 9 NC_CHAR, value = time_bnds

    time=693605 days since 0000-01-01 00:00:00
    time=693635.5 days since 0000-01-01 00:00:00
    time=693666 days since 0000-01-01 00:00:00
    time=693696.5 days since 0000-01-01 00:00:00
    time=693727.5 days since 0000-01-01 00:00:00
    time=693758 days since 0000-01-01 00:00:00
    time=693788.5 days since 0000-01-01 00:00:00

     
  • Charlie Zender
    Charlie Zender
    2011-05-11

    yes, upgrading to 4.0.8 should fix the calendar probrlem you are having.
    cz

     
  • hi zender i want to subset a section from a global dataset, using the following command ncks -d lon,min,max -d lat,min,max in.nc out.nc but everytime it is showing that dimension lon is not in input file what could be the reason?i need it to be done very urgently, if you can help me.. i will be relieved..

     
  • Charlie Zender
    Charlie Zender
    2013-06-13

    probably your dataset uses a dimension name other than lon for longitude. please read the manual http://nco.sf.net/nco.html#hyp

     
  • Craig Cobb
    Craig Cobb
    2013-07-24

    Hello zender, I'm having the same problem as arumita-ban.  I'm using the correct dimension names and consistent value formats (floating point). In fact the function works if you use either lat or lon but not both.  I've checked the script on another machine (v 4.2.1) and it works fine, but unfortunately I cannot run it there and I need it operationally.  Any suggestions?  This is for only one type of model we that uniquely contains all parameters and taus into a single file unlike other models which are split into individual taus.  Thanks for any suggestions.

     
  • Charlie Zender
    Charlie Zender
    2013-07-24

    Seems like you must have an old buggy version so you need to upgrade the machine you are running on.
    Building from source is super easy and never ever fails :)
    http://nco.sf.net#bld