In [1]:
import gridgeo
gridgeo.__version__
Out[1]:
In [2]:
url = 'http://colossus.dl.stevens-tech.edu:8080/thredds/dodsC/latest/Complete_gcmplt.nc'
grid = gridgeo.GridGeo(
url,
standard_name='sea_water_temperature'
)
In [3]:
grid.mesh
Out[3]:
In [4]:
print(f'The grid has {len(grid.polygons)} polygons, showing the first 5.')
grid.geometry[:5]
Out[4]:
In [5]:
grid.outline
Out[5]:
In [6]:
%matplotlib inline
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
fig, ax = plt.subplots(
figsize=(9, 9),
subplot_kw={'projection': ccrs.PlateCarree()}
)
ax.plot(
grid.x, grid.y, 'darkgray',
grid.x.T, grid.y.T, 'darkgray',
alpha=0.25,
)
ax.coastlines(resolution='10m');
In [7]:
import folium
x, y = grid.outline.centroid.xy
m = folium.Map(location=[y[0], x[0]])
folium.GeoJson(grid.outline.__geo_interface__).add_to(m)
m.fit_bounds(m.get_bounds())
m
Out[7]: