Free pointer error issue with cdo
Added by Ilias Moysidis almost 2 years ago
When I try using cdo I always get the following error:
```
free(): invalid pointer
Aborted
```
For example:
```
cdo timmean tas_historical_CNRM-CERFACS-CNRM-CM5_KNMI-RACMO22E_r1i1p1_19710101-19751231.nc temp.nc
cdo timmean: Processed 1 variable over 1826 timesteps [5.52s 73MB].
free(): invalid pointer
Aborted
```
or
```
cdo -z zip -mergetime tas_historical_CNRM-CERFACS-CNRM-CM5_KNMI-RACMO22E_r1i1p1_19710101-19751231.nc tas_historical_CNRM-CERFACS-CNRM-CM5_KNMI-RACMO22E_r1i1p1_19760101-19801231.nc temp.nc
cdo mergetime: Processed 2 variables over 3653 timesteps [33.98s 83MB].
free(): invalid pointer
Aborted
```
In case it is useful, the specifics of the netcdf files are
```
netcdf tas_historical_CNRM-CERFACS-CNRM-CM5_KNMI-RACMO22E_r1i1p1_19710101-19751231 {
dimensions:
bnds = 2 ;
rlon = 424 ;
rlat = 412 ;
time = UNLIMITED ; // (1826 currently)
variables:
char rotated_pole ;
rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
rotated_pole:grid_north_pole_latitude = 39.25f ;
rotated_pole:grid_north_pole_longitude = -162.f ;
double rlon(rlon) ;
rlon:axis = "X" ;
rlon:standard_name = "grid_longitude" ;
rlon:long_name = "longitude in rotated pole grid" ;
rlon:units = "degrees" ;
double lon(rlat, rlon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
double rlat(rlat) ;
rlat:axis = "Y" ;
rlat:standard_name = "grid_latitude" ;
rlat:long_name = "latitude in rotated pole grid" ;
rlat:units = "degrees" ;
double lat(rlat, rlon) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
double height ;
height:axis = "Z" ;
height:standard_name = "height" ;
height:long_name = "height" ;
height:units = "m" ;
height:positive = "up" ;
double time(time) ;
time:units = "days since 1949-12-01 00:00:00" ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:calendar = "standard" ;
time:bounds = "time_bnds" ;
double time_bnds(time, bnds) ;
float tas(time, rlat, rlon) ;
tas:standard_name = "air_temperature" ;
tas:long_name = "Near-Surface Air Temperature" ;
tas:units = "K" ;
tas:cell_methods = "time: mean" ;
tas:coordinates = "lon lat height" ;
tas:grid_mapping = "rotated_pole" ;
tas:missing_value = 1.e+20f ;
tas:_FillValue = 1.e+20f ;
// global attributes:
:Conventions = "CF-1.4" ;
:contact = "Erik van Meijgaard, KNMI, Regional Climate division (vanmeijg@knmi.nl)" ;
:experiment = "Historical run" ;
:experiment_id = "historical" ;
:realization = "1" ;
:driving_experiment = "CNRM-CERFACS-CNRM-CM5,historical,r1i1p1" ;
:driving_model_id = "CNRM-CERFACS-CNRM-CM5" ;
:driving_model_ensemble_member = "r1i1p1" ;
:driving_experiment_name = "historical" ;
:institution = "Royal Netherlands Meteorological Institute, De Bilt, The Netherlands" ;
:institute_id = "KNMI" ;
:model_id = "KNMI-RACMO22E" ;
:rcm_version_id = "v2" ;
:references = "http://www.knmi.nl/research/weather-climate-models" ;
:project_id = "CORDEX" ;
:CORDEX_domain = "EUR-11" ;
:product = "output" ;
:frequency = "day" ;
:knmi_global_comment = "" ;
:knmi_model_comment = "RACMO22E: baseline physics from ECMWF CY31r1; modifications include HTESSEL CY33r1, patch K-diffusion CY32r3, moist Turbulent Kinetic Energy, satellite inferred Leaf Area Index" ;
:knmi_version_comment = "v2: reference version for Europe and other midlatitude regions" ;
:knmi_grib_path = "mos.knmi.nl:/climreg/CXEUR12/eR2v2-v545-fCNRM-r1i1p1+hist/GRIB_data" ;
:creation_date = "2018-11-02T00:59:09Z" ;
:driving_experiment_comment = "Known issue correction: this simulation (labeled v2) is not affected by the error previously identified in the model level data of CNRM-CERFACS-CNRM-CM5,historical,r1i1p1 (see http://www.umr-cnrm.fr/cmip5/IMG/pdf/communication-issue-files_cnrm-cm5_historical_6hlev_en.pdf for more information); LBC fields driving this simulation have been inferred from pressure level data " ;
:c3s_disclaimer = "This data has been produced in the context of the C3S_34b_Lot1 and Lot 2 projects (PRINCIPLES/CORDEX4CDS) as a data provider for the Climate Data Store within the Copernicus Climate Change Service (C3S - https://climate.copernicus.eu/). While abiding by the highest scientific and technical standards, ECMWF cannot warrant that any information provided by the C3S will be entirely free from errors or omissions or that such errors or omissions can or will be rectified entirely. This applies to data from projects that continue to be developed, but are made publicly available for the purpose of feedback and testing. Some data or metadata may have been created or structured in files or formats that are not error-free. ECMWF accepts no responsibility with regard to such problems incurred as a result of using this data (see http://climate.copernicus.eu/disclaimer-privacy for the full disclaimer)" ;
:tracking_id = "hdl:21.14103/788a3abf-bbe5-4405-81b2-7988e6e04bc1" ;
```
and
```
netcdf tas_historical_CNRM-CERFACS-CNRM-CM5_KNMI-RACMO22E_r1i1p1_19760101-19801231 {
dimensions:
bnds = 2 ;
rlon = 424 ;
rlat = 412 ;
time = UNLIMITED ; // (1827 currently)
variables:
char rotated_pole ;
rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
rotated_pole:grid_north_pole_latitude = 39.25f ;
rotated_pole:grid_north_pole_longitude = -162.f ;
double rlon(rlon) ;
rlon:axis = "X" ;
rlon:standard_name = "grid_longitude" ;
rlon:long_name = "longitude in rotated pole grid" ;
rlon:units = "degrees" ;
double lon(rlat, rlon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
double rlat(rlat) ;
rlat:axis = "Y" ;
rlat:standard_name = "grid_latitude" ;
rlat:long_name = "latitude in rotated pole grid" ;
rlat:units = "degrees" ;
double lat(rlat, rlon) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
double height ;
height:axis = "Z" ;
height:standard_name = "height" ;
height:long_name = "height" ;
height:units = "m" ;
height:positive = "up" ;
double time(time) ;
time:units = "days since 1949-12-01 00:00:00" ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:calendar = "standard" ;
time:bounds = "time_bnds" ;
double time_bnds(time, bnds) ;
float tas(time, rlat, rlon) ;
tas:standard_name = "air_temperature" ;
tas:long_name = "Near-Surface Air Temperature" ;
tas:units = "K" ;
tas:cell_methods = "time: mean" ;
tas:coordinates = "lon lat height" ;
tas:grid_mapping = "rotated_pole" ;
tas:missing_value = 1.e+20f ;
tas:_FillValue = 1.e+20f ;
// global attributes:
:Conventions = "CF-1.4" ;
:contact = "Erik van Meijgaard, KNMI, Regional Climate division (vanmeijg@knmi.nl)" ;
:experiment = "Historical run" ;
:experiment_id = "historical" ;
:realization = "1" ;
:driving_experiment = "CNRM-CERFACS-CNRM-CM5,historical,r1i1p1" ;
:driving_model_id = "CNRM-CERFACS-CNRM-CM5" ;
:driving_model_ensemble_member = "r1i1p1" ;
:driving_experiment_name = "historical" ;
:institution = "Royal Netherlands Meteorological Institute, De Bilt, The Netherlands" ;
:institute_id = "KNMI" ;
:model_id = "KNMI-RACMO22E" ;
:rcm_version_id = "v2" ;
:references = "http://www.knmi.nl/research/weather-climate-models" ;
:project_id = "CORDEX" ;
:CORDEX_domain = "EUR-11" ;
:product = "output" ;
:frequency = "day" ;
:knmi_global_comment = "" ;
:knmi_model_comment = "RACMO22E: baseline physics from ECMWF CY31r1; modifications include HTESSEL CY33r1, patch K-diffusion CY32r3, moist Turbulent Kinetic Energy, satellite inferred Leaf Area Index" ;
:knmi_version_comment = "v2: reference version for Europe and other midlatitude regions" ;
:knmi_grib_path = "mos.knmi.nl:/climreg/CXEUR12/eR2v2-v545-fCNRM-r1i1p1+hist/GRIB_data" ;
:creation_date = "2018-11-02T01:53:56Z" ;
:driving_experiment_comment = "Known issue correction: this simulation (labeled v2) is not affected by the error previously identified in the model level data of CNRM-CERFACS-CNRM-CM5,historical,r1i1p1 (see http://www.umr-cnrm.fr/cmip5/IMG/pdf/communication-issue-files_cnrm-cm5_historical_6hlev_en.pdf for more information); LBC fields driving this simulation have been inferred from pressure level data " ;
:c3s_disclaimer = "This data has been produced in the context of the C3S_34b_Lot1 and Lot 2 projects (PRINCIPLES/CORDEX4CDS) as a data provider for the Climate Data Store within the Copernicus Climate Change Service (C3S - https://climate.copernicus.eu/). While abiding by the highest scientific and technical standards, ECMWF cannot warrant that any information provided by the C3S will be entirely free from errors or omissions or that such errors or omissions can or will be rectified entirely. This applies to data from projects that continue to be developed, but are made publicly available for the purpose of feedback and testing. Some data or metadata may have been created or structured in files or formats that are not error-free. ECMWF accepts no responsibility with regard to such problems incurred as a result of using this data (see http://climate.copernicus.eu/disclaimer-privacy for the full disclaimer)" ;
:tracking_id = "hdl:21.14103/02f3f8b6-8717-45c4-9dda-12172e3d43d5" ;
```
My system runs on Ubuntu 20.04.5 LTS, codename focal. I have installed CDO following the documentation guidelines for unix systems, i.e. using sudo apt-get install cdo.
Replies (5)
RE: Free pointer error issue with cdo - Added by Estanislao Gavilan almost 2 years ago
Hi
It could be a bug of your cdo version. I think the cdo version of ubuntu 20 is 1.9.8. You can always get the last version (2.1) via anaconda. Otherwise you need to upgrade to ubuntu 22 to get the version 2.0.5 or build it from the source
Kind regards,
Estanislao
RE: Free pointer error issue with cdo - Added by Ilias Moysidis almost 2 years ago
Could you please expand on 'You can always get the last version (2.1) via anaconda'. I am new to ubuntu. To install software I use sudo apt-get install from the terminal.
RE: Free pointer error issue with cdo - Added by Estanislao Gavilan almost 2 years ago
Hi,
Take a look to the "Documentation section 1.1.1.3. Conda". That section explains how to install anaconda and cdo in UNIX.
Kind regards,
Estanislao
RE: Free pointer error issue with cdo - Added by Karin Meier-Fleischer almost 2 years ago
Have a look at the installtion instruction for annaconda and miniconda which I recommend :
RE: Free pointer error issue with cdo - Added by Ilias Moysidis almost 2 years ago
Ok, it worked. Thank you!
I created a conda enviroment and run the cdo command through the python terminal without any errors.