Project

General

Profile

griddes Unsupported file type

Added by Justin Yan 26 days ago

I'm using cdo 2.4.0 on wsl, and I created a grid file with the following content: #
  1. gridID 1 #
    gridtype = lonlat
    gridsize = 1036800
    xsize = 1440
    ysize = 720
    xname = lon
    xlongname = "Longitude"
    xunits = "degrees_east"
    yname = lat
    ylongname = "Latitude"
    yunits = "degrees_north"
    xfirst = 0.125
    xinc = 0.25
    yfirst = -89.875
    yinc = 0.25

Upon using cdo griddes to assess the grid file, I got ' Open failed on >outgrid.txt< Unsupported file type'. I also tried generating a grid file directly from a cmip6 data file, the generated grid file looks ok, but cdo griddes still reported the same error.


Replies (13)

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

Maybe the gridfile contains hidden Windows special sequences like ^M at the beginning. I guess you used a Windows editor to create the gridfile then you have to convert it, e.g. with dos2unix.

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

Hi Karin, thanks for the reply. I have tried converting the file to unix format with 'dos2unix mygirdfile.txt'. cdo griddes still reported the same error.

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

Sorry, do you try to do 'cdo griddes gridfile.txt' ? That can't work because it needs the data file as input file not the grid file. See https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#page.36

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

Thanks for the clarification. A follow-up question if I may. I created two grid files ingrid.txt (a tripolar gird created using griddes from data file) and outgrid.txt (0.25*0.25 lonlat).
I tried several remap commands.
cdo remapbil,outgrid.txt infile.nc outfile.nc error: open failed on outgrid.txt
cdo remapbil,outgrid.txt -setgrid,ingrid.txt infile.nc outfile.nc works well, and the result checks out

I wonder if it's the grid of my input file too complicated that remapbil requires information on the input grid?

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

Can you upload the input file? Without knowing the input file it is not possible to say why it only works with the given setgrid operator.

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

Here's the input file. I chose one timestep and resampled it as the original one-timestep file is too large for upload.

inputfile_resampled.nc (39.5 MB) inputfile_resampled.nc tripolar gridded global surface windstress_eastward

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

Sorry, I'm not able to reproduce your error.

Using version 2.4.0:

cdo -remapbil,outgrid.txt inputfile_resampled.nc outfile.nc
cdo    remapbil: Bilinear weights from curvilinear (1800x1151) to lonlat (1440x720) grid, with source mask (1322455)
cdo    remapbil: Processed 2071800 values from 1 variable over 1 timestep [2.37s 409MB]

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

I can't reproduce the error either with the resampled input file. But the error persists with the original file. I'll find a way to upload the original input file later.

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

Hi Karin. I managed to compress the input file to zip.

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

Sorry again, but also with CDO 2.4.0 (installed with conda-forge: conda create -n cdo240 cdo=2.4.0 ) and the inputfile.nc I'm not able to reproduce the error.

(cdo240) [~/Downloads] > cdo -remapbil,outgrid.txt inputfile.nc outfile2.nc
cdo    remapbil: Bilinear weights from curvilinear (3600x2302) to lonlat (1440x720) grid, with source mask (5289728)
cdo    remapbil: Processed 8287200 values from 1 variable over 1 timestep [4.67s 913MB]

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

I copied your code and the error is resolved. My previous code does not have the '-' before remapbil, so this is merely a syntax error?

RE: griddes Unsupported file type - Added by Karin Meier-Fleischer 25 days ago

It also works without the '-' when it is the first operator, all following operators needs a leading '-'.

(cdo240) [~/Downloads] > cdo remapbil,outgrid.txt inputfile.nc outfile2.nc
cdo    remapbil: Bilinear weights from curvilinear (3600x2302) to lonlat (1440x720) grid, with source mask (5289728)
cdo    remapbil: Processed 8287200 values from 1 variable over 1 timestep [4.60s 913MB]

RE: griddes Unsupported file type - Added by Justin Yan 25 days ago

Understood, thanks for the help :)

    (1-13/13)