Commit 1386f061 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Slight improvements for GeoArray.show_map().


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 80c5bc59
Pipeline #29346 failed with stage
in 1 minute and 59 seconds
......@@ -1362,22 +1362,29 @@ class GeoArray(object):
# get image to plot
# (reproject to LonLat as workaround in case self.epsg is None because cartopy relies on an existing EPSG code)
nodataVal = nodataVal if nodataVal is not None else self.nodata
gA2plot = GeoArray(*self._get_plottable_image(xlim, ylim, band, boundsMap=boundsMap,
boundsMapPrj=boundsMapPrj, res_factor=res_factor,
gA2plot = GeoArray(*self._get_plottable_image(xlim, ylim, band,
boundsMap=boundsMap,
boundsMapPrj=boundsMapPrj,
res_factor=res_factor,
nodataVal=nodataVal,
out_prj=None if self.epsg is not None else 4326),
# FIXME EPSG:4326 fails for extraterrestrial data
out_prj=self.epsg or 4326
),
nodata=nodataVal)
image2plot = gA2plot[:]
# create map
def get_cartopy_crs_from_epsg(epsg_code):
try:
return ccrs_from_epsg(epsg_code)
except ValueError:
if epsg_code == 4326:
return PlateCarree()
else:
raise NotImplementedError('The show_map() method currently does not support the given projection.')
if epsg_code:
try:
return ccrs_from_epsg(epsg_code)
except ValueError:
if epsg_code == 4326:
return PlateCarree()
else:
raise NotImplementedError('The show_map() method currently does not support the given projection.')
else:
raise ValueError(f'Expected a valid EPSG code. Got {epsg_code}.')
crs_in = get_cartopy_crs_from_epsg(gA2plot.epsg)
crs_out = get_cartopy_crs_from_epsg(out_epsg if out_epsg is not None else gA2plot.epsg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment