File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,9 @@ def test_check_crs():
261261 [
262262 '+init=epsg:26911' ,
263263 'PlateCarree' ,
264+ 'epsg:6933' ,
265+ 6933 ,
266+ 'EPSG: 6933' ,
264267 ],
265268)
266269def test_process_crs (input ):
Original file line number Diff line number Diff line change @@ -303,14 +303,24 @@ def process_crs(crs):
303303 crs = crs .to_wkt ()
304304
305305 errors = []
306- if isinstance (crs , (str , int )): # epsg codes
306+ if isinstance (crs , (str , int , pyproj .Proj )):
307+ wkt = crs
308+ if isinstance (crs , (str , int )): # epsg codes
309+ try :
310+ wkt = pyproj .CRS .from_epsg (crs ).to_wkt ()
311+ except Exception as e :
312+ errors .append (e )
307313 try :
308- crs = pyproj . CRS . from_epsg ( crs ). to_wkt ()
314+ return proj_to_cartopy ( wkt ) # should be all proj4 or wkt strings
309315 except Exception as e :
310316 errors .append (e )
311- if isinstance (crs , (str , pyproj .Proj )): # proj4/wkt strings
317+
318+ if isinstance (crs , (str , int )):
319+ if isinstance (crs , str ):
320+ # pyproj does not expect epsg to be prefixed with `EPSG:`
321+ crs = crs .upper ().replace ('EPSG:' , '' ).strip ()
312322 try :
313- return proj_to_cartopy (crs )
323+ return ccrs . epsg (crs )
314324 except Exception as e :
315325 errors .append (e )
316326
You can’t perform that action at this time.
0 commit comments