[gradsusr] converting GRIB to .dat for FORTRAN

Ryglicki, Dr. David david.ryglicki at nrlmry.navy.mil
Wed May 8 10:38:43 EDT 2019


Before you "quit" you have to display the variable, like "d t2m" or whatever it's called in the ERA5 file.

Another tip --  instead of using world coordinates for bounds ("set lat" and "set lon"), use "set x" and "set y" and the exact grid dimensions (I think they're 1440 for nx and 721 for ny).

From: gradsusr [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Stephan Steyn
Sent: Tuesday, May 7, 2019 7:58 AM
To: gradsusr at gradsusr.org
Subject: [gradsusr] converting GRIB to .dat for FORTRAN

Dear GrADS users

As described on https://ds.data.jma.go.jp/tcc/tcc/library/MRCS_SV12/sstdata/readme_grib_e.htm I am attempting to use a GrADS script to convert  a GRIB file (in the form of ERA5 gridded surface data) to a .dat file that I can read with FORTRAN (4-byte real floating point format). I already have fortran programs that can ingest this format.

I managed to use "grib2ctl.pl" to create the .ctl file (copied below) and "gribmap" to create a .grib.idx file and successfully display the data in GrADS.
Upon executing "run convert.gs" (copied below) within GrADS I don't receive any error messages, only to find that the .dat file was never created. I also tried to make subsets of the data with the same non-result.

I am using GrADS Version 2.0.2 run on 64-bit Fedora in a Oracle Virtualbox on Lenovo Thinkpad (Core i7).

I am pretty much stuck now... Please help!

Stephan

*** convert.gs ***
*---------------------------------------------------------------------
function main()
* Please edit the following line to match your computer environment:
mydir='/home/stephan/ERA5'
'open ERA5_sfcvar12_197901.ctl'
'set lon 0.00 359.75'
'set lat -90.00 90.00'
'set time jan1979'
'set gxout fwrite'
'set fwrite 'mydir'/ERA5_sfcvar12_197901.dat'
'quit'
*----------------------------------------------------------------------

Below the content of "ERA_sfcvar12_197901.ctl": -----------------------
dset ^ERA5_sfcvar12_197901.grib
index ^ERA5_sfcvar12_197901.grib.idx
undef 9.999E+20
title ERA5_sfcvar12_197901.grib
*  produced by grib2ctl v0.9.15
* command line options: ERA5_sfcvar12_197901.grib
dtype grib 255
options yrev
ydef 721 linear -90.000000 0.25
xdef 1440 linear 0.000000 0.250000
tdef 31 linear 12Z01jan1979 1dy
zdef 1 linear 1 1
vars 4
no10Usfc  0 165,1,0  ** surface 10 metre U wind component [m s**-1]
no10Vsfc  0 166,1,0  ** surface 10 metre V wind component [m s**-1]
no2Dsfc  0 168,1,0  ** surface 2 metre dewpoint temperature [K]
no2Tsfc  0 167,1,0  ** surface 2 metre temperature [K]
ENDVARS

________________________________
University of the Free State: This message and its contents are subject to a disclaimer.
Please refer to http://www.ufs.ac.za/disclaimer for full details.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20190508/a5282885/attachment.html>


More information about the gradsusr mailing list