Project

General

Profile

Problem with CMORPH data descriptor file when trying to extract binary files

Added by Anthony Guamán about 1 year ago

Hi,

I found CDO very useful, but I'm new using it, so I found some difficulties when I work with this tool.

I've been trying to extract binaries files of 2022 year in ".gz" format, you can find here a monthly sample [[ftp://ftp.cpc.ncep.noaa.gov/precip/CMORPH_RT/GLOBE/data/2022/202201/]] and here it is the GrADS data descriptor file [[ftp://ftp.cpc.ncep.noaa.gov/precip/CMORPH_RT/GLOBE/data/CTL/CMORPH_V0.x_RT_8km-30min.ctl]].

I tried with this line of code to complete the task:

cdo -b nc import_binary CMORPH_V0.x_RT_8km-30min.ctl outfile.nc

But I only got a .nc file with no data just lon and lat variables.

I read documentation about GrADS and how to import binary data sets, but still having problems. I was able to find that the problem is relationated with the .ctl file, so I found 2 problems with my .ctl file.

This is the original data of the .ctl file:

DSET ^../%y4/%y4%m2/CMORPH_V0.x_RT_8km-30min_%y4%m2%d2%h2
OPTIONS little_endian template
UNDEF -999.0
TITLE CMORPH Rain Rate (Real-Time Version)
XDEF  4948 LINEAR   0.0363783345 0.072756669
YDEF  1649 LINEAR -59.963614312  0.072771376
ZDEF     1 LEVELS   1
TDEF 99999 LINEAR 00:00z01Jan2017 30mn
VARS 1
cmorph  1  99  CMORPH Rain Rate [mm/hr]
ENDVARS

The first problem is relationated with the referential time "TDEF", wich starts on 2017-01-01, but should start on 2022-01-01. In order to solve this problem, I tried the solution that the following post recommends [[https://code.mpimet.mpg.de/boards/1/topics/7713?r=7722#message-7722]], so I used the following line of code:

cdo -r -f nc -setreftime,2022-01-01,00:00:00,minutes -import_binary CMORPH_V0.x_RT_8km-30min.ctl outfile.nc

But after this, I didn't even get the .nc file, I just got the following warming message:

cdo(2) import_binary: Process started
cdo(2) import_binary (Warning): Could not open file: ../2017/201701/CMORPH_V0.x_RT_8km-30min_2017010100

Error (pstreamToPointer): pstream index -1 undefined!

This helped me find the second problem, wich is that I have "DSET ^../%y4/%y4%m2/CMORPH_V0.x_RT_8km-30min_%y4%m2%d2%h2" when I should have "DSET ^CMORPH_V0.x_RT_8km-30min_%y4%m2%d2%h2", but I couldn't find a way to change this.

If anyone has any additional suggestions or thoughts on the matter, please assist.

Thanks kindly.
Anthony


Replies (2)

RE: Problem with CMORPH data descriptor file when trying to extract binary files - Added by Karin Meier-Fleischer about 1 year ago

Hi Anthony,

this is a GrADS issue. You have to understand how to use the .ctl file because you have to do some changes (which should be described on its download page).

You have to change the TDEF line to the correct number of files and change the year to the used year, here 2022.

E.g. for the first 2 files:

DSET ^CMORPH_V0.x_RT_8km-30min_%y4%m2%d2%h2
OPTIONS little_endian template
UNDEF -999.0
TITLE CMORPH Rain Rate (Real-Time Version)
XDEF  4948 LINEAR   0.0363783345 0.072756669
YDEF  1649 LINEAR -59.963614312  0.072771376
ZDEF     1 LEVELS   1
*
TDEF 2 LINEAR 00:00z01Jan2022 30mn
*
VARS 1
cmorph  1  99  CMORPH Rain Rate [mm/hr]
ENDVARS
    (1-2/2)