Issues with geographic information on generated output images

76 views
Skip to first unread message

Mariana Güereque

unread,
Dec 19, 2013, 10:35:34 PM12/19/13
to pyt...@googlegroups.com
Hi,

I am using pytroll to generate RGB dust composites of METEOSAT09 SEVIRI HRIT datasets.
The purpose is to geolocate a position (lat/long) in QGIS in the output TIFF files.
I can generate output TIFF files, but they lack geographic information.

My issue is similar to described by BoCheng in the following thread:
https://groups.google.com/forum/#!msg/pytroll/JbOHd9DRH_M/UNofWxTSBckJ

From reading that thread I gather I must incorporate add_overlay(), but I have been unsuccessful this far.
I should mention I'm a complete newbie to python.
I would greatly appreciate any help in this issue.

I have looked at the geo_image.py file and I just cannot get it to work.

Here is my code:
from mpop.satellites import PolarFactory
import mpop.scene
from datetime import datetime, timedelta
from mpop.projector import get_area_def
from pyresample import utils
from mpop.satellites import GeostationaryFactory
from mpop.projector import get_area_def
from mpop.instruments.visir import VisirCompositer
import datetime
from PIL import Image, ImageFont
from pycoast import ContourWriter
from pycoast import ContourWriterAGG
from mpop.imageo import geo_image
from mpop.imageo.geo_image import GeoImage
import mpop
time_slot = datetime.datetime(2009, 07, 11, 12, 00)
global_data = GeostationaryFactory.create_scene("meteosat", "09", "seviri", time_slot)
globald = get_area_def("atlantic")
global_data.load([7.3, 8.7, 10.8, 12.0], area_extent=(-8995000, -1665000, 1110000, 3665000))
area_def = globald
print global_data
geotrf = [area_def.area_extent[0], area_def.pixel_size_x, 0,area_def.area_extent[3], 0, -area_def.pixel_size_y]
img = global_data.image.dust()
img.save("./dust2lam.png")

I have not attached my datasets for they are quite large, but let me know if you really need them and I can try to find a way.
Thank you,
Mariana Güereque

Roberto Perea

unread,
Dec 20, 2013, 1:28:39 AM12/20/13
to pyt...@googlegroups.com
greetings,

in addition to this post gdalinfo display the pixel information and not the lat/lon info

Roberto

Raspaud Martin

unread,
Dec 20, 2013, 1:39:14 AM12/20/13
to pyt...@googlegroups.com
Hi Mariana,

I would add a call to add_overlay just before you last line, like this:

...
img = global_data.image.dust()
img.add_overlay()
img.save("./dust2lam.png")

Tell us how it goes !
Best regards,
Martin

Skickat från min HTC
--
You received this message because you are subscribed to the Google Groups "pytroll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Martin Raspaud

unread,
Dec 20, 2013, 3:35:02 AM12/20/13
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mariana, Roberto,

It looks like there are many things in your script, but not all of
them are used :)

So, let me have take at it:

from mpop.satellites import GeostationaryFactory
from datetime import datetime

time_slot = datetime(2009, 7, 11, 12, 0)
global_data = GeostationaryFactory.create_scene("meteosat", "09",
"seviri", time_slot)
global_data.load(global_data.image.dust.prerequisites,
area_extent=(-8995000, -1665000, 1110000, 3665000))
global_data.area_def = global_data[8.7].area_def

img = global_data.image.dust()
img.add_overlay()
img.save("./dust2lam.tif", compression=0)

Some details:

- the only way to save geographical information in a image is to save
it in geotiff format. PNG won't save any geographical information.
- you don't have to put the channels to load explicitly for the
predefined composites, each of them has a prerequisites attribute.
- the area definition for the global data has to be taken from one of
the channels. This is because on loading, different channels might
have different resolutions or different area definitions. But in this
case we're safe :)

Best regards,
Martin


On 20/12/13 07:28, Roberto Perea wrote:
> greetings,
>
> in addition to this post gdalinfo display the pixel information and
> not the lat/lon info
>
> Roberto
>
> On Thursday, December 19, 2013 8:35:34 PM UTC-7, Mariana Güereque
> wrote:
>>
>> Hi,
>>
>> I am using pytroll to generate RGB dust composites of METEOSAT09
>> SEVIRI HRIT datasets. The purpose is to geolocate a position
>> (lat/long) in QGIS in the output TIFF files. I can generate
>> output TIFF files, but they lack geographic information.
>>
>> My issue is similar to described by BoCheng in the following
>> thread:
>> https://groups.google.com/forum/#!msg/pytroll/JbOHd9DRH_M/UNofWxTSBckJ
>>
>>
>>
- From reading that thread I gather I must incorporate add_overlay(), but I
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJStAE2AAoJEBdvyODiyJI4fH4H/0PjHqfldSm81KaKwKFf+z2d
M7wxn0acn0w86/2ocHSkFyea71AtkF/ONDNS11p8UjM+3KBBudp/4aYgbv9jtfOM
8NEPJracS55Ez1rR/H/YvZTwIwW6NYH+/fdOHJH6T7DSVxCqnPhTSGfqw2fwA3rO
A1IfpkrUSLmQbrZ6AfGrfnuS+w0q3wvKXOWCjuR34a2kQd2S9M6TsfYTD013oNZ1
O7tJr3sZXDmQgGRbdtFpyk5BiHRHIkX7ZtDBAtUskx/oN/HFvH58QYAij+0KnVqv
roI1YwE2ILLq/xP1ToCYqI5xLp0x8evYhGENCHSa7eKzAzk7r9SooNFK1iteGwY=
=I11s
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Roberto Perea

unread,
Jan 2, 2014, 11:34:38 AM1/2/14
to pyt...@googlegroups.com
Hi Martin,

I did the changes and it worked.

Thanks a lot!


On Thursday, December 19, 2013 8:35:34 PM UTC-7, Mariana Güereque wrote:
Reply all
Reply to author
Forward
0 new messages