GOES-16 Product Manipulation using Free Software Tools

Channel_13.png

The image above was generated using a GOES-16 simulated image sample downloaded from the GOES-R official webpage. To generate this plot, three freely available software were used: GDAL, GMT and IMAGEMAGICK. In the Tutorials section of this Blog, you will find a 114 page tutorial on the usage of these tools (using GNC-A data).

2000px-GDALLogoColor.svg.pngIn this particular GOES-16 case, this simulated sample from the Channel 13 (10.35 um) was used. It is in NetCDF4, and has the same structure of the files that will be broadcasted through GNC-A.

The script below shows all the instructions used to generate the image above.

Basically, these are the functions performed by each software:

  • GDAL: Format conversion and image georeferencing.
  • GMT: Math, Color Palette, Projection, Shapefiles, Borders, Text and Legend
  • IMAGEMAGICK: Logo
# [GDAL] Converts the GOES-16 Channel 13 subdatased to NetCDF (format accepted by GMT)
gdal_translate -of netCDF -a_srs "+proj=geos +a=6378137. +b=6356752.31414 +lon_0=-89.5 +f=.00335281068119356027 +h=35786023. +sweep=x" -a_ullr -5434894.885056 5434894.885056 5434894.885056 -5434894.885056 HDF5:"OR_ABI-L2-CMIPF-M4C13_G16_s20161811455312_e20161811500135_c20161811500199.nc"://CMI Channel_13.nc -a_nodata -1

# [GDAL] Assigns a georeference to the image
gdalwarp -s_srs "+proj=geos +a=6378137. +b=6356752.31414 +lon_0=-89.5 +f=.00335281068119356027 +h=35786023. +sweep=x" -t_srs "+proj=latlong +datum=WGS84" Channel_13.nc Channel_13r.nc

# [GMT] Multiply the pixels by 0.039071999, sums 173.14999 and subtracts 273.15 to convert to Celsius.
grdmath Channel_13r.nc 0.039071999 MUL 173.14999 ADD -273.15 ADD = Channel_13.nc

# [GMT] Creates a color palette using the McIDAS-X IR4AVHRR6 color table, considering
# the lower limit as -103, the upper limit as 105, and intervals of 1 degree
makecpt -CIR4AVHRR6 -T-103/105/1 > C:\VLAB\CMI\palette.cpt

# [GMT] Chooses the plot size
gmtset PS_MEDIA A0

# [GMT] Projects the image, making the plot (post script format)
grdimage Channel_13.nc -JG-84.00/00.00/35775/0/0/0/0/0/10i -R-180/180/-90/90 -CC:\VLAB\CMI\palette.cpt -K > Channel_13.ps

# [GMT] Defines the border type ("plain", "inside" or "fancy")
gmtset MAP_FRAME_TYPE fancy

# [GMT] Defines the border thickness
gmtset MAP_FRAME_WIDTH 1.5p

# [GMT] Defines the border division thickness
gmtset MAP_TICK_LENGTH 0

# [GMT] Defines the size of the numbers in the border and legend
gmtset FONT_ANNOT_PRIMARY 9p 

# [GMT] Defines the size of the scale and legend titles
gmtset FONT_LABEL 9p 

# [GMT] Defines the characteristics of the grid primary line
gmtset MAP_GRID_PEN_PRIMARY 0.3p,white,-

# [GMT] Defines the border lat long characteristcs
pscoast -Ba5g10WSne -N1/0.0p,white -O -K -R -J >> Channel_13.ps

# [GDAL] Converts a shapefile to the GMT format
ogr2ogr -f "GMT" C:\VLAB\paises.gmt C:\VLAB\paises.shp
ogr2ogr -f "GMT" C:\VLAB\estados.gmt C:\VLAB\estados.shp

# [GMT] Adds the shapefiles to the final image.
psxy C:\VLAB\paises.gmt -W0.5p,black -R -J -O -K >> Channel_13.ps
psxy C:\VLAB\estados.gmt -W0.5p,black -R -J -O -K >> Channel_13.ps

# [GMT] Adds a text in the final image, according to the file "text_channel_13.txt"
pstext text_channel_13.txt -F+f+a+j -G0/0/0 -R -J -O -K >> Channel_13.ps

# [GMT] Adds a legend according to the specified color table
psscale -Dx0c/-0.5c+w25.1c/0.3c+h+e -CC:\VLAB\CMI\palette.cpt -B10:"Brightness Temperature [\260C]": -O >> Channel_13.ps

# [GMT] Converts the post script file to ".png"
psconvert -GC:\programs\gs\gs9.18\bin\gswin64c.exe Channel_13.ps -P -E300 -Tg -A -DC:\VLAB\CMI

# [ImageMagick] Adds the GNC-A Blog Logo the image
convert -composite C:\VLAB\CMI\Channel_13.png C:\VLAB\CMI\Blog_Logo.png -geometry +10+10 C:\VLAB\CMI\Channel_13.png

# Deletes all supporting files
del Channel_13.nc
del Channel_13r.nc
del Channel_13r.ps
del Channel_13.ps
del palette.cpt

In this link, you may download the additional files used to run this script (shapefiles, blog logo, color table and text).

Advertisement

2 thoughts on “GOES-16 Product Manipulation using Free Software Tools

  1. Pingback: Plotting GOES-16 Data With Python – Part I | GNC-A Blog

  2. Pingback: GOES-16 Products Generated by GEONETCasters [2] | GNC-A Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s