kmarkert / cartoee Goto Github PK
View Code? Open in Web Editor NEWPublication quality maps using Earth Engine and Cartopy
Home Page: https://cartoee.readthedocs.io/en/latest/index.html
License: GNU General Public License v3.0
Publication quality maps using Earth Engine and Cartopy
Home Page: https://cartoee.readthedocs.io/en/latest/index.html
License: GNU General Public License v3.0
Ref. openjournals/joss-reviews#1207
version number mismatch: you have published release 0.03
(on github) where it should be 0.0.3
(like on pip)
installation / list of dependencies: I've tried installing with jupyter lab/python3 and I get an error from ee indicating that it's probably only compatible with python2. Is this correct, and can you clarify this situation? Please mention that ee is a dependency too (even if that's pretty obvious).
(That's all I can say for now. I'll be back later if I manage to install it.)
I get the following error when I want to run an example using a different projection:
TypeError: 'numpy.float64' object cannot be interpreted as an integer
Any idea why this is and how to fix this?
I am trying to run the first example
ax = cee.getMap(srtm,region=bbox,visParams=visualization)
ax.coastlines()
plt.show()
and getting the following error.
HttpError Traceback (most recent call last)
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
344 try:
--> 345 return call.execute(num_retries=num_retries)
346 except googleapiclient.errors.HttpError as e:
~/anaconda3/envs/py36/lib/python3.6/site-packages/oauth2client/_helpers.py in positional_wrapper(*args, **kwargs)
132 logger.warning(message)
--> 133 return wrapped(*args, **kwargs)
134 return positional_wrapper
~/anaconda3/envs/py36/lib/python3.6/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
841 if resp.status >= 300:
--> 842 raise HttpError(resp, content, uri=self.uri)
843 return self.postproc(resp, content)
HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails?fields=name&alt=json returned "Pixel grid dimensions (432000x144000) must be less than or equal to 10000.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
in
2
3 # plot the map
----> 4 ax = cee.getMap(srtm,cmap='terrain',region=bbox,visParams=visualization)
5 # add a color bar using cartoee
6 cb = cee.addColorbar(ax,loc='right',cmap='terrain',visParams=visualization)
~/anaconda3/envs/py36/lib/python3.6/site-packages/cartoee-0.0.5-py3.6.egg/cartoee/plotting.py in getMap(imgObj, proj, **kwargs)
32
33 ax = plt.axes(projection=proj)
---> 34 ax = addLayer(imgObj,ax=ax,**kwargs)
35
36 return ax
~/anaconda3/envs/py36/lib/python3.6/site-packages/cartoee-0.0.5-py3.6.egg/cartoee/plotting.py in addLayer(imgObj, ax, dims, region, cmap, visParams)
94 args[key] = visParams[key]
95
---> 96 url = imgObj.getThumbUrl(args)
97 img = urlopen(url)
98 a = plt.imread(img)
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/deprecation.py in Wrapper(*args, **kwargs)
30 filename=func.code.co_filename,
31 lineno=func.code.co_firstlineno + 1)
---> 32 return func(*args, **kwargs)
33 deprecation_message = '\nDEPRECATED: ' + message
34 try:
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/image.py in getThumbURL(self, params)
490 # behaviour.
491 if data._use_cloud_api: # pylint: disable=protected-access
--> 492 return data.makeThumbUrl(self.getThumbId(params))
493 image, params = self._apply_visualization(params)
494 params['image'] = image
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/image.py in getThumbId(self, params)
462 image, params = image._apply_visualization(params) # pylint: disable=protected-access
463 params['image'] = image
--> 464 return data.getThumbId(params)
465
466 def getThumbURL(self, params=None):
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/data.py in getThumbId(params, thumbType)
822 result = _execute_cloud_call(
823 _get_cloud_api_resource().projects().thumbnails().create(
--> 824 parent=_get_projects_path(), fields='name', body=request))
825 return {'thumbid': result['name'], 'token': ''}
826 request = params.copy()
~/anaconda3/envs/py36/lib/python3.6/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
345 return call.execute(num_retries=num_retries)
346 except googleapiclient.errors.HttpError as e:
--> 347 raise _translate_cloud_exception(e)
348
349
EEException: Pixel grid dimensions (432000x144000) must be less than or equal to 10000.
This example from the documentation of cartoee gives an error when adding cmap for the colorbar (but works when using custom palette)
# get an earth engine image
srtm = ee.Image("CGIAR/SRTM90_V4")
# vis
visualization = {'min':-500,'max':3000,'bands':'elevation'}
bbox = [-180,-90,180,90]
# plot the map
ax = cee.getMap(srtm,cmap='terrain',
region=bbox,
visParams=visualization,
dims=1000)
# add a color bar using cartoee
cb = cee.addColorbar(ax,loc='right',
cmap='terrain',
visParams=visualization)
ax.coastlines()
TypeError Traceback (most recent call last)
in ()
14 cb = cee.addColorbar(ax,loc='right',
15 cmap='terrain',
---> 16 visParams=visualization)
17
18 ax.coastlines()
2 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/init.py in _check_isinstance(_types, **kwargs)
2126 ", ".join(names[:-1]) + " or " + names[-1]
2127 if len(names) > 1 else names[0],
-> 2128 type_name(type(v))))
2129
2130
TypeError: 'cmap' must be an instance of matplotlib.colors.Colormap or None, not a str
Hi,
I have tried to run the cartoee example docs in colab platform but it shows error in colorbar 'cmap' function and it doesn't work on subplots.
srtm = ee.Image("CGIAR/SRTM90_V4")
visualization = {'min':-500,'max':3000,'bands':'elevation'}
bbox = [-180,-90,180,90]
ax = cee.getMap(srtm,cmap='terrain',
region=bbox,
visParams=visualization,
dims=1000)
cb = cee.add_colorbar(ax,visualization,loc='right',cmap='terrain')
ax.coastlines()
AttributeError: module 'cartoee' has no attribute 'add_colorbar'
#set up a blank map with multiple subplots
fig,ax = plt.subplots(ncols=2,nrows=2,figsize=(10,7),
subplot_kw={'projection': ccrs.Orthographic(-80,35)})
imgs = np.array([[djf,mam],[jja,son]])
titles = np.array([['DJF','MAM'],['JJA','SON']])
for i in range(len(imgs)):
for j in range(len(imgs[i])):
ax[i,j] = cee.addLayer(imgs[i,j],ax=ax[i,j],
region=bbox,dims=500,
visParams=ndviVis,cmap='YlGn'
)
ax[i,j].coastlines()
ax[i,j].gridlines(linestyle='--')
ax[i,j].set_title(titles[i,j])
plt.tight_layout()
cax = fig.add_axes([0.9, 0.2, 0.02, 0.6])
cb = cee.addColorbar(ax[i,j],ndviVis,cax=cax,cmap='YlGn')
plt.show()
TypeError: 'cmap' must be an instance of matplotlib.colors.Colormap or None, not a str
ValueError: provided loc not of type str. options are "left", "top", "right", or "bottom"
/usr/local/lib/python3.7/dist-packages/cartopy/mpl/geoaxes.py:820: MatplotlibDeprecationWarning: Passing the minor parameter of set_yticks() positionally is deprecated since Matplotlib 3.2; the parameter will become keyword-only two minor releases later. return super(GeoAxes, self).set_yticks(yticks, minor)
How can I resolve it? any suggestion or solution???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.