Project

General

Profile

Can't read NC file from IFREMER (France)

Added by Aurélien TRICAULT over 3 years ago

Hello,

I'm trying to convert some IFREMER currents netCDF (see attached) file to Grib to use them in boat routing application.

I tried over Cygwin and embeded Ubuntu (20.04) whitout success.

With Cygwin I got an error :

cdo    copy: Open failed on >infile.nc<

The result of command cdo -V is :

Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo)
System: x86_64-unknown-cygwin
CXX Compiler: g++ -g -Wall -O2 -DPIC -pie -mwindows -ftree-vectorize -fopenmp
CXX version : g++ (GCC) 7.4.0
C Compiler: gcc -g -Wall -O2 -DPIC -pie -mwindows -ftree-vectorize -fopenmp
C version : gcc (GCC) 7.4.0
F77 Compiler: gfortran -g -O2
F77 version : GNU Fortran (GCC) 7.4.0
Features: 15GB 8threads C++14 Fortran DATA PTHREADS OpenMP HDF5 NC4/HDF5 OPeNDAP UDUNITS2 PROJ SSE2
Libraries: HDF5/1.10.2 proj/5.2.0
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
     CDI library version : 1.9.8
 cgribex library version : 1.9.4
 ecCodes library version : 2.9.0
  NetCDF library version : 4.6.1 of May 26 2018 18:07:01 $
    hdf5 library version : 1.10.2
    exse library version : 1.4.1
    FILE library version : 1.8.3

Using Ubuntu embedded, I can't manage to run CDO, I got an error :

cdo: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

But "libqt5gui5 is already the newest version (5.12.8+dfsg-0ubuntu1)"

Could somebody help?
Could you try the enclosed file to telle me if there is something wrong with it? Or any option I missed?

Thanks

infile.nc (3.23 MB) infile.nc

Replies (6)

RE: Can't read NC file from IFREMER (France) - Added by Aurélien TRICAULT over 3 years ago

OK, I manage to make CDO works over Embeded Ubuntu.
I've to put this command :

sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 

The cdo - V command returns :

Climate Data Operators version 1.9.9rc1 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fopenmp
CXX version : g++ (Ubuntu 9.2.1-28ubuntu1) 9.2.1 20200203
C Compiler: gcc -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC  -fopenmp
C version : gcc (Ubuntu 9.2.1-28ubuntu1) 9.2.1 20200203
F77 Compiler: f77 -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong
F77 version : unknown
Features: 15GB 8threads C++14 Fortran DATA PTHREADS OpenMP HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.10.4 proj/6.3.0 curl/7.68.0(h7.66.0)
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
     CDI library version : 1.9.9rc1
 ecCodes library version : 2.16.0
  NetCDF library version : 4.7.3 of Jan 23 2020 04:18:16 $
    hdf5 library version : library undefined
    exse library version : 1.4.1
    FILE library version : 1.8.3

But I got this error when I execute the command : cdo -v -f grb2 -copy infile.nc output.grb

ECCODES ERROR   :  concept: no match for cfName=ocean_sigma_variable
ECCODES ERROR   :  concept: input handle edition=2
Here are the possible values for concept cfName:
        air_pressure_at_mean_sea_level
        air_temperature
        atmosphere_relative_vorticity
        depth_of_isosurface_of_sea_water_potential_temperature
        divergence_of_wind
        eastward_sea_water_velocity
        eastward_wind
        geopotential
        geopotential_height
        kinetic_energy_dissipation_in_atmosphere_boundary_layer
        lagrangian_tendency_of_air_pressure
        land_binary_mask
        northward_sea_water_velocity
        northward_wind
        ocean_mixed_layer_thickness_defined_by_sigma_theta
        relative_humidity
        sea_ice_area_fraction
        sea_ice_thickness
        sea_surface_height_above_geoid
        sea_surface_salinity
        specific_humidity
        surface_air_pressure
        surface_downward_eastward_stress
        surface_downward_northward_stress
        surface_downwelling_shortwave_flux_in_air
        surface_net_downward_longwave_flux_assuming_clear_sky
        surface_net_downward_shortwave_flux
        surface_net_downward_shortwave_flux_assuming_clear_sky
        surface_net_upward_longwave_flux
        surface_roughness_length
        surface_upward_latent_heat_flux
        surface_upward_sensible_heat_flux
        toa_outgoing_longwave_flux
!!! grib_set_string(    grib_handle* h, "cfName", "ocean_sigma_variable") !!!
Warning (gribapiDefParam): grib_api: No match for cfName=ocean_sigma_variable
ECCODES ERROR   :  concept: no match for shortName=SIG
ECCODES ERROR   :  concept: input handle edition=2
!!! grib_set_string(    grib_handle* h, "shortName", "SIG") !!!
Warning (gribapiDefParam): grib_api: No match for shortName=SIG
gribapiDefLevel   : Changed zaxis type from generic to pressure
Warning (gribapiDefLevel): Pressure level of -0.500000 Pa is below zero!
ECCODES ERROR   :  Key "scaledValueOfFirstFixedSurface": Trying to encode a negative value of -5 for key of type unsigned

!!! failed call to grib_set_long(       grib_handle* h, "scaledValueOfFirstFixedSurface", -5) !!!
../../../../libcdi/src/stream_gribapi.c at line 2377: my_grib_set_long(gh, "scaledValueOfFirstFixedSurface", scaled_level) failed: Encoding invalid

RE: Can't read NC file from IFREMER (France) - Added by Ralf Mueller over 3 years ago

hi Aurélien!

the standard name cannot be found in your eccodes installation. you can change the standard_name attribute with the setattribute operator, but that won't help a lot. your input uses a projection, which cannot be saved in GRIB. sorry

cheers
ralf

RE: Can't read NC file from IFREMER (France) - Added by Aurélien TRICAULT over 3 years ago

OK, thank you.

Then I'll have to know the correspondances between my file attribute names and standards ones, is it right?
Is there a way to know the list of attributes names used in my file?

And to finish, how can I change the projection to make the conversion works?

RE: Can't read NC file from IFREMER (France) - Added by Ralf Mueller over 3 years ago

you can use

 ncdump -h infile.nc
ncdump comes with every netcdf installation AFAIK

hth
ralf

RE: Can't read NC file from IFREMER (France) - Added by Ralf Mueller over 3 years ago

you can interpolate the data onto a simpler regular grid

  # select a smaller region for data reduction
  cdo -sellonlatbox,-5,-1,45,48 infile.nc infileSel.nc

  # create grid file with the same region but finer resolution
  cdo -sellonlatbox,-5,-1,45,48 -topo,global_0.2 grid.nc

  # perform interpolation:
  #  nearest neighbour or
  cdo remapnn,grid.nc infileSel.nc infile_nn.nc
  # bilinear
  cdo remapbil,grid.nc infileSel.nc infile_bil.nc

hth
ralf

RE: Can't read NC file from IFREMER (France) - Added by Aurélien TRICAULT over 3 years ago

Thank you very much Ralf...

I go ahead with the conversion... But I still have an issue

gribapiDefLevel   : Changed zaxis type from generic to pressure
Warning (gribapiDefLevel): Pressure level of -0.500000 Pa is below zero!
ECCODES ERROR   :  Key "scaledValueOfFirstFixedSurface": Trying to encode a negative value of -5 for key of type unsigned

!!! failed call to grib_set_long(       grib_handle* h, "scaledValueOfFirstFixedSurface", -5) !!!
../../../../libcdi/src/stream_gribapi.c at line 2377: my_grib_set_long(gh, "scaledValueOfFirstFixedSurface", scaled_level) failed: Encoding invalid

It seems that it tries to put zaxis variable to atmospheric pressure... But with negatives values, that crashes!

I'm trying to cancel thi zaxis values...

    (1-6/6)