MERC vs LCC gives different plot-results

67 views
Skip to first unread message

Dzengiz Tafa

unread,
Aug 16, 2015, 6:29:17 AM8/16/15
to wradlib-users
Hi

We are trying to put a PPI image (radial velocity) to Google Maps. To achieve that goal we wish to plot a PPI image on a Mercator projection, so it is compatible with Google Maps.
However, I seem to be having problems with the output being generated.

When plotting the image on an LCC projection I get the following result:
In python: m = Basemap(llcrnrlon='1', llcrnrlat='49', urcrnrlon='10', urcrnrlat='54', projection='lcc', resolution='i',lat_0=51.182972,lon_0=3.094839)


This image is correct, because the range of the radar is correct & the center of the radar-image is positioned where it should be.


When plotting the same image by using the mercator projection, the result is somewhat different
In python: m = Basemap(projection='merc',llcrnrlat=49,urcrnrlat=54,llcrnrlon=1,urcrnrlon=10,resolution='i',lat_0=51.182972,lon_0=3.094839)

As you can see from a comparison between the images is that the centerpoint of the radar matches. So this seems to be correct. But there is a notable difference between the size of the images. The image (range) in mercator projection is a lot smaller than the LCC projection.


Both plot-calls are done by this rule ax, ppi = wradlib.vis.plot_ppi(masked_array, r, az, autoext=True, site=(x,y), elev=0.4, vmin=-80, vmax=80, cmap=my_cmap)


I am searching for an explanation why the plot might be different when using a different projections. Does wradlib have issues when plotting to a mercator grid? If so how can I go around this & if not: how can i fix this? Can it be that using a different projection requires a different plot-call?


As of now I am out of ideas. If any one could point me in the right direction I would be very thankfull.



Best regards,


Dzengiz

Kai Mühlbauer

unread,
Aug 16, 2015, 6:44:28 AM8/16/15
to wradli...@googlegroups.com
Hi Dzengiz,

could you provide a minimal example? It's not totally clear how you
wradlib.vis.plot_ppi and basemap are working together in your application.

Cheers,
Kai
Am 16.08.2015 um 12:29 schrieb Dzengiz Tafa:
> Hi
>
> We are trying to put a PPI image (radial velocity) to Google Maps. To
> achieve that goal we wish to plot a PPI image on a Mercator projection,
> so it is compatible with Google Maps.
> However, I seem to be having problems with the output being generated.
>
> When plotting the image on an LCC projection I get the following result:
> In python: *m = Basemap(llcrnrlon='1', llcrnrlat='49', urcrnrlon='10',
> urcrnrlat='54', projection='lcc',
> resolution='i',lat_0=51.182972,lon_0=3.094839)*
>
> <https://lh3.googleusercontent.com/-smWk5MSqQo0/VdBf1ec64GI/AAAAAAAAAAo/u7rL2OKeOl4/s1600/BVEL_debilt_LM_LCC_test.png>
>
>
> This image is correct, because the range of the radar is correct & the
> center of the radar-image is positioned where it should be.
>
>
> When plotting the same image by using the mercator projection, the
> result is somewhat different
> In python:* **m =
> Basemap(projection='merc',llcrnrlat=49,urcrnrlat=54,llcrnrlon=1,urcrnrlon=10,resolution='i',lat_0=51.182972,lon_0=3.094839)*
> *
> *
>
> <https://lh3.googleusercontent.com/-bJnWyeClSPM/VdBhLtRhtzI/AAAAAAAAAA0/DOOVlDg9xho/s1600/BVEL_debilt_LM_test.png>
>
> As you can see from a comparison between the images is that the
> centerpoint of the radar matches. So this seems to be correct. But there
> is a notable difference between the size of the images. The image
> (range) in mercator projection is a lot smaller than the LCC projection.
>
>
> Both plot-calls are done by this rule *ax, ppi =
> wradlib.vis.plot_ppi(masked_array, r, az, autoext=True, site=(x,y),
> elev=0.4, vmin=-80, vmax=80, cmap=my_cmap)*
>
> *
> *
>
> I am searching for an explanation why the plot might be different when
> using a different projections. Does wradlib have issues when plotting to
> a mercator grid? If so how can I go around this & if not: how can i fix
> this? Can it be that using a different projection requires a different
> plot-call?
>
>
> As of now I am out of ideas. If any one could point me in the right
> direction I would be very thankfull.
>
>
>
> Best regards,
>
>
> Dzengiz
>
> --
> You received this message because you are subscribed to the Google
> Groups "wradlib-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wradlib-user...@googlegroups.com
> <mailto:wradlib-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Dzengiz Tafa

unread,
Aug 16, 2015, 7:54:24 AM8/16/15
to wradlib-users, kai.mue...@uni-bonn.de
Hi Kai

I stripped the code down to the very basics. I have created a rar file for you to download.
You can find the link here http://we.tl/lYs4khmAbz

To see what I mean, Just comment the one & uncomment the other basemap line & run the code with each one.

Thank you very much for your willingness to take a look at it.
It is much appreciated.

Best regards

Dzengiz

Kai Mühlbauer

unread,
Aug 16, 2015, 11:09:25 AM8/16/15
to Dzengiz Tafa, wradlib-users
Hi Dzengiz,

I can reproduce your results.

Just being curious: why do you need basemap? Just for "map-making" and
plotting some borders, rivers?

Cheers,
Kai

Kai Mühlbauer

unread,
Aug 16, 2015, 11:55:00 AM8/16/15
to wradli...@googlegroups.com
Dzengiz,

if you use the transverse mercator projection, it works on my system, at
least the images are somehow similar.

m =
Basemap(projection='tmerc',llcrnrlat=49,urcrnrlat=54,llcrnrlon=1,urcrnrlon=10,resolution='i',lat_0=51.182972,lon_0=3.094839)

I do not know, if that is a flaw in basemap or intended behaviour, or if
some parameters are missing to the mercator projection.

If you depend on basemap only to draw borders and stuff, have a look at
overlay_example.py.

The wradlib developers decided to drop basemap support and to implement
support for projections via 'gdal'. Also support for plotting data from
shapefiles (borders, rivers et cetera) was added.

Unfortunetaly a comprehensive tutorial is still missing, but will come
hopefully soon. Have a look here, every once in a while:
https://bitbucket.org/wradlib/wradlib/issues/73/doc-chapter-on-georeferencing

Cheers,
Kai

Jonathan Helmus

unread,
Aug 17, 2015, 11:08:18 AM8/17/15
to wradli...@googlegroups.com
Dzengiz,

    Adding  "lat_ts=51.182972" when creating a Mercator projection will improve the look of the projection.   So use the following:

m =
Basemap(projection='merc',llcrnrlat=49,urcrnrlat=54,llcrnrlon=1,urcrnrlon=10,resolution='i',lat_0=51.182972,lon_0=3.094839, lat_ts=51.182972)


The default value for this argument is 0 for mercator projection which is only appropriate near the equator.

Cheers,

     - Jonathan Helmus
Reply all
Reply to author
Forward
0 new messages