[gradsusr] Generating png Image and georeferencing with GrADS

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Tue Dec 29 17:25:38 EST 2020


Hi All,

I'm generating PNG files in North America and the farther west I go the 
more squashed the image is along the X-axis (longitude) with background 
color to the right and left of the content that gets rendered.



# East coast:
ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/multi_1.20201229/wna.t00z.grib.grib2

# West coast:
ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/multi_1.20201229/enp.t00z.grib.grib2

# processing for east coast:
wgrib2 wna.t00z.grib.grib2 -set_grib_type c3 -grib_out 00wna.grb

g2ctl.pl 00wna.nc > 00wna.ctl
gribmap -i 00wna.ctl

wgrib2 00.grb -netcdf 00.nc

# loop over 00wna.nc and for each hour generate a PNG
grads -blc 'run wavecast_new.gs wna '

lat1=20.3
lat2=48.0
lon1=262  (-98)
lon2=302  (-58)
xpix=8000
ypix=5540

And I create a world file for each image like:

0.005
0.0
0.0
-0.005
-98.0
48.0


Same processing as above but with the enp file for the west coast
and like wise the western insert has params like:

lat1=30
lat2=50
lon1=230  (-130)
lon2=245  (-115)
xpix=3000
ypix=4000

and a world file like:

0.005
0.0
0.0
-0.005
-130.0
50.0

And I get an images like the attached that are overlaid on my map.

I'm thinking that this might be caused by the fact that my image area 
does not align exactly with the area of the grib file. I thought the 
process was extracting data as a sub-windows, but I didn't develop these 
scripts so I'm not sure. If the generated png needs to match the grib 
exactly, how do I extract the dimensions of the grib.

Thanks,
   -Steve



ga-> q config
Config: v2.2.1 little-endian readline grib2 netcdf hdf4-sds hdf5 geotiff 
shapefile
Grid Analysis and Display System (GrADS) Version 2.2.1
Copyright (C) 1988-2018 by George Mason University
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Configured on 12/29/19 for x86_64-unknown-linux-gnu

This build of GrADS has the following features:
  -+- Byte order is LITTLE ENDIAN
  -+- Athena Widget GUI DISABLED
  -+- Command line editing ENABLED
  -+- GRIB2 interface ENABLED  g2clib-1.6.0
  -+- NetCDF interface ENABLED  netcdf-4.6.0
  -+- OPeNDAP gridded data interface DISABLED
  -+- OPeNDAP station data interface DISABLED
  -+- HDF4 interface ENABLED  hdf-4.2r13
  -+- HDF5 interface ENABLED  hdf5-1.10.0
  -+- KML contour output ENABLED
  -+- GeoTIFF and KML/TIFF output ENABLED
  -+- Shapefile interface ENABLED
The 'q gxconfig' command returns Graphics configuration information


$ ncdump -h /maps/reefcast/wavebin-data/00.nc
netcdf \00 {
dimensions:
         latitude = 203 ; <<<<<<<< this looks weird for latitude
         longitude = 275 ;
         time = UNLIMITED ; // (61 currently)
variables:
         double latitude(latitude) ;
                 latitude:units = "degrees_north" ;
                 latitude:long_name = "latitude" ;
         double longitude(longitude) ;
                 longitude:units = "degrees_east" ;
                 longitude:long_name = "longitude" ;
         double time(time) ;
                 time:units = "seconds since 1970-01-01 00:00:00.0 0:00" ;
                 time:long_name = "verification time generated by wgrib2 
function verftime()" ;
                 time:reference_time = 1609243200. ;
                 time:reference_time_type = 3 ;
                 time:reference_date = "2020.12.29 12:00:00 UTC" ;
                 time:reference_time_description = "forecasts or 
accumulated (including analyses), reference date is fixed" ;
                 time:time_step_setting = "auto" ;
                 time:time_step = 10800. ;
         float WIND_surface(time, latitude, longitude) ;
                 WIND_surface:_FillValue = 9.999e+20f ;
                 WIND_surface:short_name = "WIND_surface" ;
                 WIND_surface:long_name = "Wind Speed" ;
                 WIND_surface:level = "surface" ;
                 WIND_surface:units = "m/s" ;
         float WDIR_surface(time, latitude, longitude) ;
                 WDIR_surface:_FillValue = 9.999e+20f ;
                 WDIR_surface:short_name = "WDIR_surface" ;
                 WDIR_surface:long_name = "Wind Direction (from which 
blowing)" ;
                 WDIR_surface:level = "surface" ;
                 WDIR_surface:units = "deg" ;
         float UGRD_surface(time, latitude, longitude) ;
                 UGRD_surface:_FillValue = 9.999e+20f ;
                 UGRD_surface:short_name = "UGRD_surface" ;
                 UGRD_surface:long_name = "U-Component of Wind" ;
                 UGRD_surface:level = "surface" ;
                 UGRD_surface:units = "m/s" ;
         float VGRD_surface(time, latitude, longitude) ;
                 VGRD_surface:_FillValue = 9.999e+20f ;
                 VGRD_surface:short_name = "VGRD_surface" ;
                 VGRD_surface:long_name = "V-Component of Wind" ;
                 VGRD_surface:level = "surface" ;
                 VGRD_surface:units = "m/s" ;
         float HTSGW_surface(time, latitude, longitude) ;
                 HTSGW_surface:_FillValue = 9.999e+20f ;
                 HTSGW_surface:short_name = "HTSGW_surface" ;
                 HTSGW_surface:long_name = "Significant Height of 
Combined Wind Waves and Swell" ;
                 HTSGW_surface:level = "surface" ;
                 HTSGW_surface:units = "m" ;
         float WVPER_surface(time, latitude, longitude) ;
                 WVPER_surface:_FillValue = 9.999e+20f ;
                 WVPER_surface:short_name = "WVPER_surface" ;
                 WVPER_surface:long_name = "Mean Period of Wind Waves" ;
                 WVPER_surface:level = "surface" ;
                 WVPER_surface:units = "s" ;
         float PERPW_surface(time, latitude, longitude) ;
                 PERPW_surface:_FillValue = 9.999e+20f ;
                 PERPW_surface:short_name = "PERPW_surface" ;
                 PERPW_surface:long_name = "Primary Wave Mean Period" ;
                 PERPW_surface:level = "surface" ;
                 PERPW_surface:units = "s" ;
         float WVDIR_surface(time, latitude, longitude) ;
                 WVDIR_surface:_FillValue = 9.999e+20f ;
                 WVDIR_surface:short_name = "WVDIR_surface" ;
                 WVDIR_surface:long_name = "Direction of Wind Waves" ;
                 WVDIR_surface:level = "surface" ;
                 WVDIR_surface:units = "deg" ;
         float DIRPW_surface(time, latitude, longitude) ;
                 DIRPW_surface:_FillValue = 9.999e+20f ;
                 DIRPW_surface:short_name = "DIRPW_surface" ;
                 DIRPW_surface:long_name = "Primary Wave Direction" ;
                 DIRPW_surface:level = "surface" ;
                 DIRPW_surface:units = "deg" ;
         float WVHGT_surface(time, latitude, longitude) ;
                 WVHGT_surface:_FillValue = 9.999e+20f ;
                 WVHGT_surface:short_name = "WVHGT_surface" ;
                 WVHGT_surface:long_name = "Significant Height of Wind 
Waves" ;
                 WVHGT_surface:level = "surface" ;
                 WVHGT_surface:units = "m" ;
         float SWELL_0insequence(time, latitude, longitude) ;
                 SWELL_0insequence:_FillValue = 9.999e+20f ;
                 SWELL_0insequence:short_name = "SWELL_0insequence" ;
                 SWELL_0insequence:long_name = "Significant Height of 
Swell Waves" ;
                 SWELL_0insequence:level = "0 in sequence" ;
                 SWELL_0insequence:units = "m" ;
         float PERSW_surface(time, latitude, longitude) ;
                 PERSW_surface:_FillValue = 9.999e+20f ;
                 PERSW_surface:short_name = "PERSW_surface" ;
                 PERSW_surface:long_name = "Secondary Wave Mean Period" ;
                 PERSW_surface:level = "surface" ;
                 PERSW_surface:units = "s" ;
         float SWPER_0insequence(time, latitude, longitude) ;
                 SWPER_0insequence:_FillValue = 9.999e+20f ;
                 SWPER_0insequence:short_name = "SWPER_0insequence" ;
                 SWPER_0insequence:long_name = "Mean Period of Swell 
Waves" ;
                 SWPER_0insequence:level = "0 in sequence" ;
                 SWPER_0insequence:units = "s" ;
         float DIRSW_surface(time, latitude, longitude) ;
                 DIRSW_surface:_FillValue = 9.999e+20f ;
                 DIRSW_surface:short_name = "DIRSW_surface" ;
                 DIRSW_surface:long_name = "Secondary Wave Direction" ;
                 DIRSW_surface:level = "surface" ;
                 DIRSW_surface:units = "deg" ;
         float SWDIR_0insequence(time, latitude, longitude) ;
                 SWDIR_0insequence:_FillValue = 9.999e+20f ;
                 SWDIR_0insequence:short_name = "SWDIR_0insequence" ;
                 SWDIR_0insequence:long_name = "Direction of Swell Waves" ;
                 SWDIR_0insequence:level = "0 in sequence" ;
                 SWDIR_0insequence:units = "deg" ;

// global attributes:
                 :Conventions = "COARDS" ;
                 :History = "created by wgrib2" ;
                 :GRIB2_grid_template = 0 ;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: grads-issue.png
Type: image/png
Size: 640379 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201229/f9d35213/attachment-0001.png>


More information about the gradsusr mailing list