cartopy

Checking if a geocoordinate point is land or ocean with cartopy?

空扰寡人 提交于 2019-11-28 04:36:15
问题 I want to know given a latitude and longitude if a coordinate is land or sea According to https://gis.stackexchange.com/questions/235133/checking-if-a-geocoordinate-point-is-land-or-ocean from mpl_toolkits.basemap import Basemap bm = Basemap() # default: projection='cyl' print bm.is_land(99.675, 13.104) #True print bm.is_land(100.539, 13.104) #False The problem is that basemap is deprecated. how di perform this with cartopy? 回答1: A question which deals with point containment testing of

Force aspect ratio for a map

那年仲夏 提交于 2019-11-28 04:12:38
问题 If I define a set of (geo)axes with a given height and width how can I make sure that the plot will fill these axes? import matplotlib.pyplot as plt import cartopy.crs as ccrs ax = plt.axes([0.3, 0.1, 0.4, 0.8], projection=ccrs.PlateCarree()) ax.coastlines() ax.set_global() plt.show() This produces a plot with a sensible aspect ratio for the map, but I wanted it to fill the axes instead, resulting in a plot taller than it is wide. This is just an example, but there are real-world scenarios

Correct placement of colorbar relative to geo axes (cartopy)

有些话、适合烂在心里 提交于 2019-11-27 23:21:26
问题 Using Cartopy, I would like to have full control of where my colorbar goes. Usually I do this by getting the current axes position as basis and then create new axes for the colorbar. This works well for standard matplotlib axes but not when using Cartopy and geo_axes, because this will distort the axes. So, my question is: how do I get the exact position of my geo_axes? Here is a code example based on the Cartopy docs http://scitools.org.uk/cartopy/docs/latest/matplotlib/advanced_plotting

Location of stored offline data for cartopy

独自空忆成欢 提交于 2019-11-27 18:13:46
问题 Where is offline data stored in cartopy? Is it stored in the data folder under site-packages? Is there any way to trigger the downloading of all available data? I would like to copy this over to a Linux machine that is not connected to the internet. I'm currently working from a Windows machine that is connected to the internet, so I'm hoping to download the data from there. Thanks. 回答1: Take a look at the config docs in http://scitools.org.uk/cartopy/docs/latest/cartopy.html. Essentially, the

preventing spurious horizontal lines for ungridded pcolor(mesh) data

醉酒当歌 提交于 2019-11-27 09:50:32
When I have a stretch of ungridded lat/lon/data pairs that cross the antimeridian, such that longitudes swap from -180 to +180, how can I prevent cartopy with pcolor(mesh) from drawing grid cells filling the entire globe? My problem is identical to the one here , except I'm using cartopy rather than basemap . A nearly 5 year old comment to the linked question (which is about basemap ) claims there is a cartopy solution but such has not been posted. Example code: #!/usr/bin/env python3.6 import numpy import matplotlib.pyplot import cartopy.crs lons = numpy.array([[-174.719, -175.297, -175.883],

Why does pcolor with masked arrays fill undesired quadrangles when projected in cartopy coordinates?

非 Y 不嫁゛ 提交于 2019-11-27 08:25:45
问题 This is a followup question to preventing spurious horizontal lines for ungridded pcolor(mesh) data and why does pcolor with masked array still fill quadrangles connecting to masked points, and how do I stop this? . In regular coordinates, when I mask both the coordinates and the data, I can plot a pcolor for coordinates that wrap around, such as longitudes, in two parts, and now I succeed to not get undesired quadrangles when in regular coordinates. However, when I transform it to map

preventing spurious horizontal lines for ungridded pcolor(mesh) data

若如初见. 提交于 2019-11-26 14:54:25
问题 When I have a stretch of ungridded lat/lon/data pairs that cross the antimeridian, such that longitudes swap from -180 to +180, how can I prevent cartopy with pcolor(mesh) from drawing grid cells filling the entire globe? My problem is identical to the one here, except I'm using cartopy rather than basemap . A nearly 5 year old comment to the linked question (which is about basemap ) claims there is a cartopy solution but such has not been posted. Example code: #!/usr/bin/env python3.6 import