Project

General

Profile

CDO grid file "invalid character"

Added by Sean Crowell about 4 years ago

Hi everyone,

I just recently updated my CDO and started using the conda build, and now my grid description files are not being read properly. I am typing the command:

cdo remapbil,grid_glb1x1 cpc_precip/precip.2015.nc cpc_precip/precip.1x1.2015.nc

and I get

Namelist error: Invalid character in grid_glb1x1 (line=1 character='�')!

The contents of grid_glb1x1 are:
gridtype=lonlat xsize=360 ysize=180 xfirst=−179.5 xinc=1 yfirst=-89.5 yinc=1

Anyone heard of any issues with conda?


Replies (10)

RE: CDO grid file "invalid character" - Added by Karin Meier-Fleischer about 4 years ago

Hi Sean,

without the grid description file I can only guess. What type is the grid_glb1x1 grid description file
(ASCII or netcdf)? Is it a binary file or is it an ASCII file then maybe there is a hidden special
charcater at line 1 character 1.

-Karin

RE: CDO grid file "invalid character" - Added by Sean Crowell about 4 years ago

Apologies, I have attached two files, one of which is ASCII and the other is a netCDF4 file.

RE: CDO grid file "invalid character" - Added by Sean Crowell about 4 years ago

Sean Crowell wrote:

Apologies, I have attached two files, one of which is ASCII and the other is a netCDF4 file.

I get the same error message for both.

RE: CDO grid file "invalid character" - Added by Ralf Mueller about 4 years ago

for a global 1-degree grid you can use the built-in shortcut 'global_1' (chaper 1.3 in docu) - no need for a griddes-file or a netcdf input.

BTW: CDO cannot read your grid file. I have no idea what is the reason behind it.

RE: CDO grid file "invalid character" - Added by Karin Meier-Fleischer about 4 years ago

The gridfile contains only one line which includes all settings.

It should be

gridtype=lonlat
xsize=360
ysize=180
xfirst=−179.5
xinc=1
yfirst=-89.5
yinc=1

RE: CDO grid file "invalid character" - Added by Sean Crowell about 4 years ago

Thank you very much for this shortcut. I will make sure to check the documentation for other shortcuts.

RE: CDO grid file "invalid character" - Added by Sean Crowell about 4 years ago

Karin Meier-Fleischer wrote:

The gridfile contains only one line which includes all settings.

It should be

[...]

Yes, that was the original way, but I copied some text off of the documentation that had it all on one line. My reasoning was that perhaps the carriage returns from my Mac oriented text editor might be causing an issue.

RE: CDO grid file "invalid character" - Added by Sean Crowell about 4 years ago

Ralf Mueller wrote:

for a global 1-degree grid you can use the built-in shortcut 'global_1' (chaper 1.3 in docu) - no need for a griddes-file or a netcdf input.

BTW: CDO cannot read your grid file. I have no idea what is the reason behind it.

Thank you very much for this shortcut. I will make sure to check the documentation for other shortcuts.

RE: CDO grid file "invalid character" - Added by Uwe Schulzweida about 4 years ago

gridtype=lonlat xsize=360 ysize=180 xfirst=−179.5 xinc=1 yfirst=-89.5 yinc=1

The first minus sign is not correct, it has the extended ASCII value 226. The second minus is correct, it has the ASCII value 45.

RE: CDO grid file "invalid character" - Added by Ralf Mueller about 4 years ago

your uploaded file 'one_degree_global_grid.nc4' has no data variable. that's why CDO cannot correctly process it.

    (1-10/10)