From 2a95122f4a59d010b6f9c3f34e9a7d6e812732b2 Mon Sep 17 00:00:00 2001 From: Andrea Grillini Date: Wed, 9 Oct 2019 13:56:45 +0200 Subject: [PATCH 1/4] Update coord2area_def.py --- utils/coord2area_def.py | 57 +++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/utils/coord2area_def.py b/utils/coord2area_def.py index 0d291b77c9..0f331f16dd 100644 --- a/utils/coord2area_def.py +++ b/utils/coord2area_def.py @@ -17,21 +17,46 @@ # satpy. If not, see . """Convert human coordinates (lon and lat) to an area definition. -Here is a usage example: +Here is a usage example. + python coord2area_def.py france stere 42.0 51.5 -5.5 8.0 1.5 -(the arguments are "name proj min_lat max_lat min_lon max_lon resolution(km)") +The arguments are "name proj min_lat max_lat min_lon max_lon resolution(km)". +The command above yelds the following result. + +### +proj=stere +lat_0=46.75 +lon_0=1.25 +ellps=WGS84 + +france: + description: france + projection: + proj: stere + ellps: WGS84 + lat_0: 46.75 + lon_0: 1.25 + shape: + height: 703 + width: 746 + area_extent: + lower_left_xy: [-559750.381098, -505020.675776] + upper_right_xy: [559750.381098, 549517.351948] + + +The first commented line is just a sum-up. The value of "description" can be changed to any descriptive text. + +Such a custom yaml configuration can be profitably saved in a local areas.yaml configuration file that won't be +overridden by future updates of SatPy package. For that purpose the local processing script may have suitable +lines as reported below. + +# set PPP_CONFIG_DIR for custom composites +import os +os.environ['PPP_CONFIG_DIR'] = '/my_local_path/for_satpy_configuration' + +As a further functionality this script may give a quick display of the defined area, +provided the path for the GSHHG library is supplied via the "-s" option. +python coord2area_def.py france stere 42.0 51.5 -5.5 8.0 1.5 -s /path/for/gshhs/library -and the result is: -REGION: france { - NAME: france - PCS_ID: stere_1.25_46.75 - PCS_DEF: proj=stere,lat_0=46.75,lon_0=1.25,ellps=WGS84 - XSIZE: 746 - YSIZE: 703 - AREA_EXTENT: (-559750.38109755167, -505020.6757764442, -559750.38109755167, 549517.35194826045) -}; +The command above would first print the seen area definition and then launch a casual representation +of the area relying on the information about borders involved. """ @@ -100,7 +125,7 @@ " +".join(("proj=" + proj + ",lat_0=" + str(lat_0) + ",lon_0=" + str(lon_0) + ",ellps=WGS84").split(",")) - print(proj4_string) + print('### ' + proj4_string) print() print(name + ":") print(" description: " + name) @@ -121,11 +146,11 @@ from PIL import Image from pycoast import ContourWriterAGG img = Image.new('RGB', (xsize, ysize)) - #proj4_string = '+proj=geos +lon_0=0.0 +a=6378169.00 +b=6356583.80 +h=35785831.0' - #area_extent = (-5570248.4773392612, -5567248.074173444, 5567248.074173444, 5570248.4773392612) + + area_def = (proj4_string, area_extent) cw = ContourWriterAGG(args.shapes) - #cw = ContourWriterAGG('/usr/share/gshhg-gmt-shp/') + cw.add_coastlines(img, (proj4_string, area_extent), resolution='l', width=0.5) From 33ac62404b0c4e9c7d6dfbe02a196aa8aa267bbf Mon Sep 17 00:00:00 2001 From: Andrea Grillini Date: Sat, 26 Oct 2019 11:23:35 +0200 Subject: [PATCH 2/4] Update coord2area_def.py --- utils/coord2area_def.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/coord2area_def.py b/utils/coord2area_def.py index 0f331f16dd..c6accee382 100644 --- a/utils/coord2area_def.py +++ b/utils/coord2area_def.py @@ -51,7 +51,8 @@ os.environ['PPP_CONFIG_DIR'] = '/my_local_path/for_satpy_configuration' As a further functionality this script may give a quick display of the defined area, -provided the path for the GSHHG library is supplied via the "-s" option. +provided the path for the GSHHG library is supplied via the "-s" option +and the modules PyCoast, Pillow and AggDraw have been installed. python coord2area_def.py france stere 42.0 51.5 -5.5 8.0 1.5 -s /path/for/gshhs/library From 3915135e4a8c37bef43a36e11679a59ce8f601da Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Thu, 26 Dec 2019 13:37:49 +0100 Subject: [PATCH 3/4] Fix trailing whitespaces --- utils/coord2area_def.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/coord2area_def.py b/utils/coord2area_def.py index c6accee382..e3727b9aba 100644 --- a/utils/coord2area_def.py +++ b/utils/coord2area_def.py @@ -147,14 +147,13 @@ from PIL import Image from pycoast import ContourWriterAGG img = Image.new('RGB', (xsize, ysize)) - - + area_def = (proj4_string, area_extent) cw = ContourWriterAGG(args.shapes) - + cw.add_coastlines(img, (proj4_string, area_extent), resolution='l', width=0.5) - cw.add_grid(img, area_def, (10.0, 10.0), (2.0, 2.0), write_text=False, outline='white', outline_opacity=175, width=1.0, - minor_outline='white', minor_outline_opacity=175, minor_width=0.2, minor_is_tick=False) + cw.add_grid(img, area_def, (10.0, 10.0), (2.0, 2.0), write_text=False, outline='white', outline_opacity=175, + width=1.0, minor_outline='white', minor_outline_opacity=175, minor_width=0.2, minor_is_tick=False) img.show() From 49785803c55d594127b9e39e76e6e2b3e9d4d3f6 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Sat, 28 Dec 2019 21:23:58 +0100 Subject: [PATCH 4/4] Add AppLEaDaY to authors --- AUTHORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 4bf67fdb88..1bc4bcf93a 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -19,6 +19,7 @@ The following people have made contributions to this project: - [Ulrik Egede (egede)](https://github.com/egede) - [Joleen Feltz (joleenf)](https://github.com/joleenf) - [Stephan Finkensieper (sfinkens)](https://github.com/sfinkens) +- [Andrea Grillini (AppLEaDaY)](https://github.com/AppLEaDaY) - [Nina HÃ¥kansson (ninahakansson)](https://github.com/ninahakansson) - [Ulrich Hamann](https://github.com/) - [Gerrit Holl (gerritholl)](https://github.com/gerritholl) @@ -53,4 +54,3 @@ The following people have made contributions to this project: - [praerien (praerien)](https://github.com/praerien) - [Xin Zhang (zxdawn)](https://github.com/zxdawn) - [Yufei Zhu (yufeizhu600)](https://github.com/yufeizhu600) -