Project

General

Profile

select lonlat without sellonlatbox or similar

Added by Álvaro Sánchez about 6 years ago

Hi everyone.

I need to select one point from a grid.
I usually use sellonlatbox for choose just one point,but now i have a netcdf file which doens't allow me to select just one point,look:

/build/grib-api-lxnGzi/grib-api-1.14.4/src/grib_accessor_class_latlon_increment.c at line 206: assertion failure Assert(numberOfPoints>1)
Abortado (`core' generado)
That's my problem,if someone can help me i would be the most graceful man in the world.

Thank you friends.


Replies (9)

RE: select lonlat without sellonlatbox or similar - Added by Ralf Mueller about 6 years ago

hi!

you can use

  • nearest-neighbour-remapping towards a single point with
    cdo remapnn,lon=44.0/lat=23.9 <ifile> <ofile>
  • selindexbox it you use regular gridded data and know the indeces for your cell or
  • selgridcell for unstructured grids

to get the indeces from your data, you can use outputkey,lon,xind,lat,yind

hth
ralf

RE: select lonlat without sellonlatbox or similar - Added by Álvaro Sánchez almost 6 years ago

It works.

Thank you very much mate,you are the best.

God bless you.

RE: select lonlat without sellonlatbox or similar - Added by Ralf Mueller almost 6 years ago

Álvaro Sánchez wrote:

It works.

Thank you very much mate,you are the best.

well, surely not - but I keep trying ;-)

RE: select lonlat without sellonlatbox or similar - Added by Álvaro Sánchez almost 6 years ago

ups,finally it didn't work :(

It seems that i can select the coordinates,and everything seems to be ok,but once i select my lonlat,and save the new data in a new file,it happens again,look:

practicas@BecarioLuis:~$ cdo remapnn,lon=358.9/lat=37.9 /home/practicas/proyecto-aerosoles/datos/12to18.nc prueba1218.nc
cdo remapnn: Nearest neighbor weights from lonlat (31x19) to lonlat (1x1) grid
cdo remapnn: Processed 4938176 values from 1 variable over 8384 timesteps ( 6.85s )

##It's ok,cdo select my lonlat,but now the same problem than before :(

practicas@BecarioLuis:~$ cdo infon /home/practicas/proyecto-aerosoles/prueba1218.nc
/build/grib-api-lxnGzi/grib-api-1.14.4/src/grib_accessor_class_latlon_increment.c at line 206: assertion failure Assert(numberOfPoints>1)
Abortado (`core' generado)

If you know why I would be two times the most graceful man in the world.

Thank you mate,best regards.

RE: select lonlat without sellonlatbox or similar - Added by Ralf Mueller almost 6 years ago

this looks strange - I need some more information.

  1. please upload the input 12to18.nc and your result file prueba1218.nc
  2. if 12to18.nc is too large, use gzio for compression or select the first 10 timesteps (cdo seltimestep,1/10) and upload the results instead
  3. please upload the output of
    cdo -V

the error comes from the grib_api IO library which has nothing to do with netcdf. Could you use infov instead of infon??

cheers
ralf

RE: select lonlat without sellonlatbox or similar - Added by Álvaro Sánchez almost 6 years ago

In first place thank you for helping me,i know that it's the 15th thanks but I really appreciate your help.

Here you have 12to18small.nc (1/10 timesteps from 12to18.nc) and prueba1218.nc,which make the problem.

practicas@BecarioLuis:~/proyecto-aerosoles/datos$ cdo -V
Climate Data Operators version 1.7.0 (http://mpimet.mpg.de/cdo)
Compiler: gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp
version: gcc (Ubuntu 5.3.1-9ubuntu2) 5.3.1 20160220
Features: DATA PTHREADS OpenMP4 HDF5 NC4/HDF5/threadsafe OPeNDAP SZ Z UDUNITS2 PROJ.4 MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.8.16 proj/4.92 curl/7.47.0
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c
CDI library version : 1.7.0
GRIB_API library version : 1.14.4
netCDF library version : 4.4.0 of Mar 29 2016 11:41:40 $
HDF5 library version : 1.8.16
SERVICE library version : 1.4.0
EXTRA library version : 1.4.0
IEG library version : 1.4.0
FILE library version : 1.8.2

and here is the output from infov,but i can't see any change.

practicas@BecarioLuis:~/proyecto-aerosoles/datos$ cdo infov prueba1218.nc/build/grib-api-lxnGzi/grib-api-1.14.4/src/grib_accessor_class_latlon_increment.c at line 206: assertion failure Assert(numberOfPoints>1)
Abortado (`core' generado)

Thanks again and sorry for the inconvenience.

RE: select lonlat without sellonlatbox or similar - Added by Ralf Mueller almost 6 years ago

with the current cdo release 1.9.3 it works fine. you should consider updating your CDO version, please have a closer look to this: https://code.mpimet.mpg.de/projects/cdo/wiki/Anaconda#Miniconda. I also tested your files with this version and this grib_api error is not there. I guess it is a problem with your CDO-installation.

another issue: your .nc are GRIB1 files.

CDO does not create files formats based on file extensions, you have to use -f nc to write nc file from grib input. Now I understand, why you get a grib_api error .... But again: please update to a newer CDO version if possible.

RE: select lonlat without sellonlatbox or similar - Added by Álvaro Sánchez almost 6 years ago

ooooooooooooooooooooh yeah

It works! Finally,now i'm pretty sure,you are the best,with no doubt.

I'm quite a noob in cdo,well,in computing,so i make silly mistakes,but i'm lucky that people like you exist and help me and help another noobs like me to improve.

Thank you very much,god bless you.

Have a nice day,week,month,year and life in general.

Best regards

    (1-9/9)