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

change value in nco

Antonio
2013-09-25
2013-10-17
  • Antonio
    Antonio
    2013-09-25

    Hi
    I need to edit a file netcdf with nco.
    the file is the initialization of the WRF model.
    I would like to eliminate the "snow" to if it has a value of less than 10 cm.
    I have no idea how to make NCO.
    I should do something like that!
    "if WEASDsfc <10, then WEASDsfc = 0, else do not modify"

     
  • Charlie Zender
    Charlie Zender
    2013-09-25

    http://nco.sf.net/nco.html#where

    ncap2 -s 'where(WEASDsfc < 10) WEASDsfc=0' in.nc out.nc

    cz

     
  • Antonio
    Antonio
    2013-09-25

    many thanks Zender!!!!!!!!!

     
  • Antonio
    Antonio
    2013-10-01

    hi Zender
    I have another little question!
    I need to extract a temperature value for a specific point of the grid.
    I tried to use many command but I could not solve.
    for example, I wrote this:

    ncks -C -v T2 -s "%.10f\n" wrfout_d02_2013-10-04_20:00:00

    but this command I print all values ​​of T 2.
    I am interested in defining a point "lat-lon"
    I have included the coordinates in many ways, but without success
    for example :
    ncks -C -v XLONG,43.0 -d XLAT,13.0,T2 -s "%.10f\n" wrfout_d02_2013-10-04_20:00:00
    do you have any suggestions for me?!

    thanks!

     
  • Charlie Zender
    Charlie Zender
    2013-10-01

    your command has syntax errors. try

    ncks -C  -d XLONG,43.0 -d XLAT,13.0  -s "%.10f\n" wrfout_d02_2013-10-04_20:00:00

    http://nco.sf.net/nco.html#xmp_ncks

     
  • Antonio
    Antonio
    2013-10-01

    hi Zender
    thanks for you help but
    is not working and does not do what I need!

    local@node01-> ncks -C -d XLAT,40.0 -d XLONG,12.0 -s "%.10f\n" wrfout_d01_2013-10-02_00:00:00
    ncks: ERROR dimension XLAT is not in input file
    but i have this variable in netcdf file!

    but I have to extract the value of T2, the point of latitude 40 and longitude 13.
    I read the manual, but I could not obtain what I need!

     
  • Charlie Zender
    Charlie Zender
    2013-10-01

    please place the file in a publicly available location so we can look at it.
    cz

     
  • Charlie Zender
    Charlie Zender
    2013-10-01

    sorry, netCDF file only. it want me to install an executable.

     
  • Antonio
    Antonio
    2013-10-01

    sorry,
    http://dropcanvas.com/w0cta

    this link works better?

     
  • Pedro Vicente
    Pedro Vicente
    2013-10-01

    Can you give a try to the latest version?

    http://nco.sourceforge.net/

    also, please post the output of

    ncks -r

    Pedro

     
  • Pedro Vicente
    Pedro Vicente
    2013-10-01

    Your file has 3 datasets

    try

    ncks -m  out.nc

    it will list the variables and their dimensions

    XLAT is a variable

    the command below is an example that hyperslabs XLAT with dimensions  south_north and west_east

    ncks -H -C -v XLAT  -d south_north,1,1,1 -d  west_east,1,1,1   out.nc

    Time south_north west_east XLAT=34.3179

    Pedro

     
  • Charlie Zender
    Charlie Zender
    2013-10-01

    WRF produces 2 or 3 dimensional irregular coordinate grids.
    Manipulating these is difficult.
    The ncks -d option only works on one-dimensional coordinates.
    ncap2 can be used to obtain valuess.
    See http://nco.sf.net/nco.html#wrf and the preceding few paragraphs.
    cz