MeteoIODoc 20240411.d3bdb3cb

Format

This plugin write data to the Portable Network Graphics format (see https://secure.wikimedia.org/wikipedia/en/wiki/Portable_Network_Graphics). No data read has been implemented, because reading an existing file would require the exact knowlege of the color gradient that has been used to create it. When writing grids, various color gradients will be used depending on the parameter that the data represents. Nodata values are represented by transparent pixels (transparency is acheived through a transparent color instead of a true alpha channel for size and performance). If a grid containing no data (ie: size 0x0) is sent to the plugin, then no file will be written. Finally, the naming scheme for meteo grids should be: YYYY-MM-DDTHH.mm_{MeteoGrids::Parameters}.png

Units

All units are MKSA except temperatures that are expressed in celcius.

Keywords

This plugin uses the following keywords:

  • COORDSYS: input coordinate system (see Coords) specified in the [Output] section
  • COORDPARAM: extra input coordinates parameters (see Coords) specified in the [Output] section
  • GRID2DPATH: meteo grids directory where to read the grids; [Output] section
  • PNG_LEGEND: plot legend on the side of the graph? (default: true)
  • PNG_MIN_SIZE: guarantee that a 2D plot will have at least the given size
  • PNG_MAX_SIZE: guarantee that a 2D plot will have at most the given size
  • PNG_SCALING: scaling algorithm, either nearest or bilinear (default=bilinear)
  • PNG_AUTOSCALE: autoscale for the color gradient? (default=true)
  • PNG_WORLD_FILE: create world file with each file? (default=false)

Advanced parameters (ie: don't mess up with them if you don't know what you're doing):

  • PNG_INDEXED: create an indexed PNG? (default=true)
  • PNG_NR_LEVELS: number of colors to use (less=smaller files, but it must be at least 5 and less than 255. default=30)
  • PNG_SPEED_OPTIMIZE: optimize file creation for speed? (default=true, otherwise optimize for file size)

The size are specified as width followed by height, with the separator being either a space, 'x' or '*'. If a minimum and a maximum size are given, the average of the smallest and largest permissible sizes will be used. The world file is used for geolocalization and goes alongside the graphics output. By convention, the file has the same name as the image file, with the third letter of the extension jammed with a w: tif->tfw, jpg->jqw. The format is the following:

5.000000000000 (size of pixel in x direction)
0.000000000000 (rotation term for row)
0.000000000000 (rotation term for column)
-5.000000000000 (size of pixel in y direction)
492169.690845528910 (x coordinate of centre of upper left pixel in map units)
5426523.318065105000 (y coordinate of centre of upper left pixel in map units)

Example use

[ouput]
GRID2D = PNG
png_legend = false
png_min_size = 400x400
png_max_size = 1366*768

pngio_compilation

In order to compile this plugin, you need libpng and zlib. For Linux, please select both the libraries and their development files in your package manager.

For Mac, starting with Sierra, you can use the system png library: from a terminal window, run /Library/Frameworks/UnixImageIO.framework/Programs/libpng-config –libdir and provide this path with libpng.dylib appended to cmake as PNG_LIBRARY_RELEASE (you might have to press t in cmake in order to show the advanced options.). Otherwise (ie if you are not using Sierra or do not want to use the system version), you can either install using Fink or directly from source. In this case, please install first zlib at the prefix of your choice (with the prefix option of its configure script, for example "./configure --prefix=/usr/local", then build with "make" and install with "sudo make install"). Then run the libpng configure script with the –enable-shared and prefix options, for example "./configure --enable-shared --prefix=/usr/local" (and then build with "make" followed by "sudo make install").

For Windows, you can find zlib at http://switch.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3.exe and libpng at http://switch.dl.sourceforge.net/project/gnuwin32/libpng/1.2.37/libpng-1.2.37-setup.exe . Once this has been installed, if you plan on using Visual c++, you also need to edit the file zconf.h in the libpng installation directory and transform the line 287:

#if 0 // HAVE_UNISTD_H etc etc

should become

#if 1 // HAVE_UNISTD_H etc etc