In this tutorial we will use nbspsatgis to convert a satellite gini file to an asc file that we will then use with the shp2img program (from the mapserver package) to create an image as shown in these samples. The following steps are involved:
We will cover each step one by one.
There are several ways to obtain the satellite data files. We will use OpenNoaaport as the data source. The files there are named like tige01_20110122_1345.gini. For the purpose of this tutorial we can just execute
wget http://www.opennoaaport.net:8015/digatmos/sat/gini/tig/tige01/latest
to retrieve the most recent tige01 file.
The raw data files are compressed, in a particular way, with zlib. On the other hand, the nbspsatgis program operates on the original, uncompressed, gini data file. We therefore use the nbspunz program, (which is part of the NbspGislib package) to uncompress the raw data file before operating on it with nbspsatgis. In one stroke, executing
nbspunz latest | nbspsatgis -A
will produce a file named like tige01_20110122_1345.gini, in asc format, as instructed by the -A option (shapefile and other formats can be produced, and the name of the output file can be changed, by passing other options to nbspsatgis).
The asc file is a text file that can be opened with any editor. It starts with the header
ncols 8017
nrows 5120
xllcorner -122.620389
yllcorner 14.275331
cellsize 0.009169
that contains the values of some parameters that can be useful, such as the extent coordinates in the map script.
The final step is to create the image from the asc file. The main ingredient besides the data file itself is the map script that will be used by the shp2img program. The map script contains, among other parameters, the following
EXTENT -122.620389 14.275331 -49.112516 61.220611
SIZE 8017 5120
which are (manually) set according to the values from the header of the asc file shown above.
The image is then produced by executing
shp2img -m tige01.map -o tige01.png
The nbspgislib tutorials contain map script(s), data file(s) and other auxiliary files (e.g., the (shape) data files to generate the country and state map outlines) to reproduce the above example and several others.