<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Examples</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>Recent changes to Examples</description><atom:link href="https://sourceforge.net/p/meteosatlib/wiki/Examples/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 29 Oct 2013 16:22:54 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/meteosatlib/wiki/Examples/feed" rel="self" type="application/rss+xml"/><item><title>Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -1,4 +1,25 @@
 [TOC]
+
+# accessing datasets
+
+when using meteosatlib command line tools it's possible to access a dataset both by pointing at one of its files:
+
+    msat --view /somepath/H-000-MSG3__-MSG3________-IR_039___-000005___-201307100230-C_
+
+or by using the special syntax `[RESOLUTION]:[SATELLITE]:[CHANNEL]:[TIMESTAMP]`
+
+    msat --view /somepath/H:MSG3:IR_039:201307100230
+
+the latter method allows to access the reflectance and solar zenith angle special datasets:
+
+    msat --view /somepath/H:MSG3:IR_039r:201307100230
+
+    msat --view /somepath/H:MSG3:IR_039a:201307100230
+
+*Note:
+- the reflectance dataset is available since meteosatlib 1.2 and only for VIS006 VIS008 IR_016 IR_039 channels
+- the solar zenith angle dataset is available since meteosatlib 1.4*
+

 # cropping

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Tue, 29 Oct 2013 16:22:54 -0000</pubDate><guid>https://sourceforge.net798f0ed1e75223cae3df5c83fe19f35377adbb9d</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v6
+++ v7
@@ -54,22 +54,47 @@
 georeferenced extents of output file (*-te* option) is not mandatory but highly recommended since original meteosat data may be huge
 
 
-# simple composite RGB
+# composite RGB products
 
-(warning: this counts as an Attention Deficit Disorder symptom)
+there's a python script in the meteosatlib sources ([example/products](http://svn.code.sf.net/p/meteosatlib/code/trunk/examples/products)) that covers part of the products described in Eumetsat's [MSG Channels Interpretation Guide](http://oiswww.eumetsat.org/WEBOPS/msg_interpretation/forecasting.php) featuring cropping, reprojection, shapefile overlaying and a help, too:
 
-it's in the [homepage](http://meteosatlib.sourceforge.net/)
+    $ ./products --help
+    Usage: products [options]
 
-full code [here](http://meteosatlib.svn.sourceforge.net/viewvc/meteosatlib/gdal/trunk/make-composite?view=markup)
+    Generate satellite products
 
-# more complex composite RGB products
+    Options:
+      --version             show program's version number and exit
+      -h, --help            show this help message and exit
+      -q, --quiet           quiet mode: only output fatal errors
+      -v, --verbose         verbose mode
+      -s SRCDIR, --srcdir=SRCDIR
+                            directory with the HRIT data. Default:
+                            /autofs/scratch1/satope/done/
+      -t TIME, --time=TIME  datetime, as 'YYYYMMDDHHMM', default: 201212121500
+      -a x,dx,y,dy, --area=x,dx,y,dy
+                            datetime, as 'YYYYMMDDHHMM', default:
+                            1350,1400,100,800
+      --shp=shapefile       shapefile to use for coastlines
+      -f fmt, --format=fmt  output file format. See gdalinfo --formats. Default:
+                            GTiff
+      -d dir, --destdir=dir
+                            output directory. Default: .
+      --warp=opts           gdalwarp options to use to warp input channels before
+                            using them. When used, area cropping is disabled.
+                            Default: none
+      --cachedir=dir        cache directory for warped channels. Default: .
 
-there's a python script in the meteosatlib-gdal sources ([example/products](http://svn.code.sf.net/p/meteosatlib/code/gdal/trunk/examples/products)) that covers part of the products described in Eumetsat's [MSG Channels Interpretation Guide](http://oiswww.eumetsat.org/WEBOPS/msg_interpretation/forecasting.php)
+example:
+
+    ./products -t 201212061200 -s ~/mydata/ --shp ~/myshp/worldboundaries.shp -d /tmp/products/ --warp='-t_srs "+proj=latlong" -te -10 30 30 60' --cachedir=/tmp/products/cache/
+
+(shapefile must be in the same projection specified in --warp options)
 
 
 # working with data arrays
 
-instancing a satellite data object, getting numpy arrays from single channels (a part of the [example/products](http://svn.code.sf.net/p/meteosatlib/code/gdal/trunk/examples/products) mentioned early)
+instancing a satellite data object, getting numpy arrays from single channels (a part of the [example/products](http://svn.code.sf.net/p/meteosatlib/code/trunk/examples/products) mentioned early)
 
 featuring [python](http://www.python.org/), [numpy](https://sourceforge.net/projects/numpy/), [gdal-python](http://pypi.python.org/pypi/GDAL/)
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Wed, 12 Dec 2012 15:19:36 -0000</pubDate><guid>https://sourceforge.net265055dba658698652266fda1c93516f9c5d45fb</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v5
+++ v6
@@ -47,7 +47,7 @@
 this is more like a [gdal](http://www.gdal.org/) feature, but you can use it on meteosat data thanks to msat-gdal driver, so here it is:
 
     # to lat/lon geotiff
-    gdalwarp -t_srs "+proj=latlong" -te 30 -10 60 30 -of GTiff /mydatapath/H:MSG2:HRV:201203130715 something.gtiff
+    gdalwarp -t_srs "+proj=latlong" -te -10 30 30 60 -of GTiff /mydatapath/H:MSG2:HRV:201203130715 something.gtiff
     # to utm32 WGS84 ENVI data format
     gdalwarp -t_srs '+proj=utm +zone=32 +datum=WGS84' -te -1349315 3475750 1657788 6838296 -of ENVI /mydatapath/H:MSG2:IR_O16:201203130715
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Thu, 22 Nov 2012 09:14:03 -0000</pubDate><guid>https://sourceforge.netb6b0d5e9f3e363bc64049cd23f9b01b9a2066b76</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -62,18 +62,45 @@
 
 full code [here](http://meteosatlib.svn.sourceforge.net/viewvc/meteosatlib/gdal/trunk/make-composite?view=markup)
 
+# more complex composite RGB products
+
+there's a python script in the meteosatlib-gdal sources ([example/products](http://svn.code.sf.net/p/meteosatlib/code/gdal/trunk/examples/products)) that covers part of the products described in Eumetsat's [MSG Channels Interpretation Guide](http://oiswww.eumetsat.org/WEBOPS/msg_interpretation/forecasting.php)
+
 
 # working with data arrays
+
+instancing a satellite data object, getting numpy arrays from single channels (a part of the [example/products](http://svn.code.sf.net/p/meteosatlib/code/gdal/trunk/examples/products) mentioned early)
 
 featuring [python](http://www.python.org/), [numpy](https://sourceforge.net/projects/numpy/), [gdal-python](http://pypi.python.org/pypi/GDAL/)
 
     #!/usr/bin/python
     import gdal
     from gdalconst import *
-    ds = gdal.Open("/mypath/H:MSG2:IR_134:201203130715", GA_ReadOnly)
-    band = ds.GetRasterBand(1)
+    import datetime
+    import os
+    import os.path
     import numpy
-    z = band.ReadRaster(0, 0, band.XSize, band.YSize, band.XSize, band.YSize, GDT_Float32)
-    a = numpy.fromstring(z, dtype=numpy.float32)
-    a.shape = (band.XSize, band.YSize)
-    # math time!
+    
+    SRCDIR = "/my/msg/data/path/"
+    AREA = (1350, 100, 1400, 800)
+
+    class Satellite(object):
+        def __init__(self, dt):
+            self.dt = dt
+
+        def gdal_dataset(self, channel_name):
+            fname = "H:MSG2:%s:%s" % (
+                    channel_name,
+                    self.dt.strftime("%Y%m%d%H%M")
+            )
+            return gdal.Open(os.path.join(SRCDIR, fname), GA_ReadOnly)
+
+        def get_array(self, channel):
+            ds = self.gdal_dataset(channel)
+            rb = ds.GetRasterBand(1)
+            return rb.ReadAsArray(*AREA)
+    
+    sat = Satellite(datetime.datetime(2012, 11, 6, 13, 15)
+    ir108 = sat.get_array("IR_108")
+    vis06 = sat.get_array("VIS006")
+    # etc...
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Wed, 07 Nov 2012 10:38:42 -0000</pubDate><guid>https://sourceforge.net536e683505bf417be33a2ca8370c3de2e960347f</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -42,6 +42,17 @@
     # netcdf:
     msat -c MsatNetCDF --area="5056,2000,448,2000" H:MSG2:WV_073:201001191215
 
+# reprojecting data
+
+this is more like a [gdal](http://www.gdal.org/) feature, but you can use it on meteosat data thanks to msat-gdal driver, so here it is:
+
+    # to lat/lon geotiff
+    gdalwarp -t_srs "+proj=latlong" -te 30 -10 60 30 -of GTiff /mydatapath/H:MSG2:HRV:201203130715 something.gtiff
+    # to utm32 WGS84 ENVI data format
+    gdalwarp -t_srs '+proj=utm +zone=32 +datum=WGS84' -te -1349315 3475750 1657788 6838296 -of ENVI /mydatapath/H:MSG2:IR_O16:201203130715
+
+georeferenced extents of output file (*-te* option) is not mandatory but highly recommended since original meteosat data may be huge
+
 
 # simple composite RGB
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Wed, 31 Oct 2012 08:53:56 -0000</pubDate><guid>https://sourceforge.net300560708bd7fa959a75b33a26302838d1ec64ad</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -1,5 +1,6 @@
-cropping
-------------------
+[TOC]
+
+# cropping
 
 graphical tool for finding out boundary box vertices:
 
@@ -7,19 +8,42 @@
 
 then:
 
-    # displaying image (area defined in pixel)
-    msat   --display   --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
-    # creating png (lat/lon defined area, the same of the above example)
-    msat   --png       --Area="31.5872,48.1860,2.7367,22.2706" H:MSG2:HRV:201203130715
-    # GRIB:
-    msat -c MsatGRIB   --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
-    # NETCDF:
-    msat -c MsatNetCDF --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
+    # area defined in pixel
+    msat   --display  --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
+    # lat/lon defined area, the same of the above example
+    msat   --display  --Area="31.5872,48.1860,2.7367,22.2706" H:MSG2:HRV:201203130715
 
 (see manpage for details on area cropping options)
 
-simple composite RGB
-------------------
+
+# output formats
+
+as the manpage says:
+
+       -c, --conv FMT
+              Convert to the given format (see gdalinfo --formats for a list)
+
+       --jpg  Convert to JPEG (with gray scale normalization).
+
+       --png  Convert to PNG (with gray scale normalization).
+
+
+meaning you can have two (very) different kinds of graphic output
+
+    # gray scale normalized png (increased contrast):
+    msat --png --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
+    # png:
+    msat -c PNG --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
+
+plus anything that gdal can handle
+
+    # grib:
+    msat -c MsatGRIB   --area="5056,2000,448,2000" H:MSG2:WV_073:201001191215
+    # netcdf:
+    msat -c MsatNetCDF --area="5056,2000,448,2000" H:MSG2:WV_073:201001191215
+
+
+# simple composite RGB
 
 (warning: this counts as an Attention Deficit Disorder symptom)
 
@@ -28,9 +52,7 @@
 full code [here](http://meteosatlib.svn.sourceforge.net/viewvc/meteosatlib/gdal/trunk/make-composite?view=markup)
 
 
-
-working with data arrays
-------------------
+# working with data arrays
 
 featuring [python](http://www.python.org/), [numpy](https://sourceforge.net/projects/numpy/), [gdal-python](http://pypi.python.org/pypi/GDAL/)
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Thu, 25 Oct 2012 14:23:46 -0000</pubDate><guid>https://sourceforge.net24275371ac623767a4719ecdfff065912b041d29</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -17,3 +17,30 @@
     msat -c MsatNetCDF --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
 
 (see manpage for details on area cropping options)
+
+simple composite RGB
+------------------
+
+(warning: this counts as an Attention Deficit Disorder symptom)
+
+it's in the [homepage](http://meteosatlib.sourceforge.net/)
+
+full code [here](http://meteosatlib.svn.sourceforge.net/viewvc/meteosatlib/gdal/trunk/make-composite?view=markup)
+
+
+
+working with data arrays
+------------------
+
+featuring [python](http://www.python.org/), [numpy](https://sourceforge.net/projects/numpy/), [gdal-python](http://pypi.python.org/pypi/GDAL/)
+
+    #!/usr/bin/python
+    import gdal
+    from gdalconst import *
+    ds = gdal.Open("/mypath/H:MSG2:IR_134:201203130715", GA_ReadOnly)
+    band = ds.GetRasterBand(1)
+    import numpy
+    z = band.ReadRaster(0, 0, band.XSize, band.YSize, band.XSize, band.YSize, GDT_Float32)
+    a = numpy.fromstring(z, dtype=numpy.float32)
+    a.shape = (band.XSize, band.YSize)
+    # math time!
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Wed, 24 Oct 2012 15:14:46 -0000</pubDate><guid>https://sourceforge.netf822b303623ca85e55be8d4025245710ae2d81f6</guid></item><item><title>WikiPage Examples modified by Daniele Branchini</title><link>https://sourceforge.net/p/meteosatlib/wiki/Examples/</link><description>cropping
------------------

graphical tool for finding out boundary box vertices:

    msat-view H:MSG2:HRV:201001191215

then:

    # displaying image (area defined in pixel)
    msat   --display   --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
    # creating png (lat/lon defined area, the same of the above example)
    msat   --png       --Area="31.5872,48.1860,2.7367,22.2706" H:MSG2:HRV:201203130715
    # GRIB:
    msat -c MsatGRIB   --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715
    # NETCDF:
    msat -c MsatNetCDF --area="5760,1792,1126,1254" H:MSG2:HRV:201203130715

(see manpage for details on area cropping options)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniele Branchini</dc:creator><pubDate>Tue, 23 Oct 2012 13:15:36 -0000</pubDate><guid>https://sourceforge.net76c9fcd32c7f4f3da8c033fe11e51dc11148d82f</guid></item></channel></rss>