Giter Site home page Giter Site logo

holoviz / geoviews Goto Github PK

View Code? Open in Web Editor NEW
567.0 567.0 75.0 49.66 MB

Simple, concise geographical visualization in Python

Home Page: http://geoviews.org

License: BSD 3-Clause "New" or "Revised" License

Python 92.22% TypeScript 6.13% Shell 0.32% JavaScript 1.33%
cartopy geographic-visualizations geoviews holoviews holoviz plotting

geoviews's Introduction



HoloViz: High-level tools to simplify visualization in Python

Test suite status Status
Site/Content version Github tag
Docs gh-pages site dev-site
Status Dashboard
Binder Binder
Code of Conduct Based on Contributor Covenant
Fiscal Sponsor Powered by NumFOCUS

What is HoloViz?

HoloViz provides high-level Python tools that are designed to work together to solve the entire problem of visualization, from conducting exploratory data analysis to deploying complex dashboards.

The core HoloViz projects are:

  • Panel: Create interactive dashboards in Jupyter notebooks or standalone apps
  • hvPlot: Quickly and interactively explore data with a familiar API
  • HoloViews: Visualize while you analyze by declaring data properties
  • GeoViews: Extend HoloViews for geographic data
  • Datashader: Render big data images in a browser
  • Lumen: Construct no-code dashboards from simple YAML specifications
  • Colorcet: Plot with perceptually based colormaps
  • Param: Declaratively code in Python
Panel Logo hvPlot Logo HoloViews Logo GeoViews Logo
Datashader Logo Lumen Logo Colorcet Logo Param Logo

All HoloViz projects are freely available for commercial or non-commercial use according to a permissive open-source license as described in each project's website.

HoloViz uses a custom open governance model and is fiscally sponsored by NumFOCUS. Consider making a tax-deductible donation to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.

NumFOCUS donation details

NumFOCUS is a 501(c)(3) non-profit charity in the United States; as such, donations to NumFOCUS are tax-deductible as allowed by law. As with any donation, you should consult with your personal tax adviser or the IRS about your particular tax situation.


What is the purpose of this specific repository?

This repository provides an entry point for the HoloViz ecosystem. The best way to experience this repository is on HoloViz.org.

This website provides:

  1. Introduction to the HoloViz organization and its projects
  2. Guidance for which HoloViz tools to start with given different use cases
  3. Demonstrations of using multiple HoloViz tools in a single workflow
  4. Communication channels and FAQ for HoloViz community members
  5. Governance, roadmap, and contributing guide for HoloViz developers

Getting Started

We recommend starting with holoviz.org/tutorial. If you already have a problem to solve that involves a particular data type, check out holoviz.org/background for guidance on which HoloViz tools to focus on.

geoviews's People

Contributors

ahuang11 avatar andreas-h avatar bjlittle avatar ceball avatar corinnebosley avatar dependabot[bot] avatar djm93dev avatar dr-irv avatar droumis avatar dwr-psandhu avatar ea42gh avatar gbrener avatar hoxbro avatar jbampton avatar jbednar avatar jjoonathan avatar jlstevens avatar jsignell avatar kebowen730 avatar marqh avatar mattpap avatar maximlt avatar nickhand avatar philippjfr avatar pmav99 avatar rhattersley avatar rsignell-usgs avatar scaine1 avatar zassa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geoviews's Issues

Kernel dies when running example notebooks

I'm just getting to grips with geoviews and it looks really helpful but many of the example notebooks break when I try to run them.

Specifically in the 'working_with_Bokeh.ipynb' notebook when running the third cell the kernel dies and logs the following error:
Assertion failed: (0 != cs), function GEOSCoordSeq_getSize_r, file geos_ts_c.cpp, line 3797.

I'm guessing this is an incompatible GEOS issue, but I just did a clean install from the condo-forge and ioam conda channels. I've attached my environment setup in geoviews_env.txt. Any thoughts appreciated.

Export Geoviews (Bokeh Backend) to standalone HTML

I am struggling to find the documentation or examples (if this is even possible) of exporting a Geoviews map/chart along with its Bokeh features to a standalone HTML document. Mainly, I am looking for a way to share the charts I make with people who don't necessarily need or know the code.

Great-circle paths

HLine and VLine will always be straight in screen coordinates, but it's important to be able to draw paths between two points that follow the great-circle path that one would need to travel in the real world. Such paths can already be plotted using the latest geoviews master (thanks @philippjfr!):

image

though it would be nice to increase the number of points to make smoother curves. Philipp also had a suggestion for exposing the coordinate transformations for when you want to work with them explicitly:

path = gv.Path([[(132, -0.08), (43.17, 51.53)]], crs=crs.Geodetic())
mercator_path = GeoConversion(path, crs=crs.GOOGLE_MERCATOR)

This all sounds good, but there are some other things that would help when working with great-circle paths. First, if there is a function in cartopy or proj4 for computing a great-circle distance between two points, it would be great to show that in an example in a GeoViews tutorial, along with the above example of plotting paths. Second, if there is not currently such a function, Philipp has some code of his own for computing it, and it would be good to add that to GeoViews so that people can work naturally with great-circle paths.

proxy setting for download WMTS element in python program

Kindly guide where to set the proxy setting in python program to load WMTS element,

NoteBook:
windows 64bit
SET http_proxy="proxy address"
SET https_proxy="proxy adress"
jupyter notebook
on notebook WMTS load easily it works fine

but it does not load WMTS elements directly from same python program
windows 64bit
SET http_proxy="proxy address"
SET https_proxy="proxy adress"

python my_program.py
raise SkipRendering("No valid tile source URL found in WMTS "

SkipRendering: No valid tile source URL found in WMTS Element, rendering skipped.

Add gv.RGB

Now that RGBs are based on datasets we should add a geoviews RGB type, which will be particularly useful when working with datashader.

'TileRenderer' object has no attribute 'set'

I'm trying to follow the Working with Bokeh tutorial. However, when I execute

%%opts WMTS [width=450 height=250 xaxis=None yaxis=None]
hv.NdLayout({name: gv.WMTS(wmts, extents=(0, -90, 360, 90), crs=ccrs.PlateCarree())
            for name, wmts in tiles.items()}, kdims=['Source']).cols(2)

I get the error

Traceback (most recent call last):

  File "/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-2.7.11/lib/python2.7/site-packages/holoviews-1.6.2-py2.7.egg/holoviews/plotting/bokeh/element.py", line 511, in initialize_plot
    self._update_glyph(glyph, properties, mapping)

  File "/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-2.7.11/lib/python2.7/site-packages/holoviews-1.6.2-py2.7.egg/holoviews/plotting/bokeh/element.py", line 468, in _update_glyph
    glyph.set(**{k: v for k, v in merged.items()

AttributeError: 'TileRenderer' object has no attribute 'set'

I'm using Geoviews 1.1.0 with HoloViews 1.6.2 and Bokeh 0.12.4.

Installation problems

I'm trying to install geoviews on a linux machine. I created a new conda environment to try it out and ran the following commands successfully:

conda create --name geoviews jupyter
conda install -c scitools/label/dev -c conda-forge iris cartopy
conda install xarray
conda install -c ioam holoviews

However when trying to install geoviews I found a problem:

conda install -c ioam geoviews
Fetching package metadata: ......
Solving package specifications: ....................................................
Error: Could not find some dependencies for geoviews: cartopy

I can confirm that cartopy is installed:

conda list
...
cartopy                   0.14.2              np111py27_1    conda-forge
...

so I'm not sure what the problem is?

Save a gv map to file

import numpy as np
import cartopy
from cartopy import crs as ccrs

from bokeh.tile_providers import CARTODBPOSITRON, CARTODBPOSITRON_RETINA, STAMEN_TERRAIN, STAMEN_TONER_BACKGROUND, STAMEN_TONER_LABELS, STAMEN_TONER
from bokeh.models import WMTSTileSource
import geoviews as gv
import holoviews as hv
hv.notebook_extension('bokeh')
%%opts WMTS [width=300 xaxis=None yaxis=None show_grid=True]
%%opts Points ( color='darkgreen' size=15 marker='d')

def extent_from_center( center, dx, dy, to=ccrs.GOOGLE_MERCATOR ):
    x,y = to.transform_point( center[0], center[1], ccrs.PlateCarree())
    return ( x-dx, y-dy, x+dx,y+dy )
lon           = np.array([-73.973599, -73.974557, -73.979744])
lat           = np.array([ 40.779770,  40.783249,  40.781216])
gv_map = gv.WMTS( CARTODBPOSITRON)
gv_map.extents = extent_from_center( (-73.974, 40.780), 500., 800., to=gv_map.crs )
h1 = gv.Points ((lon, lat), crs=ccrs.PlateCarree())
gv_map*h1

results in a plot with an inactive bokeh 'save to file' tool

Add support for crs on holoviews datashader operations

Datashader is very useful when working with geospatial data and holoviews now offers datashader operations. One major issue is that these operations do not currently handle a crs, which makes it difficult to work with them. The main obstacle here is that a) there is no geoviews RGB type, which could be used to hold the output of datashade and b) that projecting on every datashader plot update is very inefficient. I'd therefore suggest a temporary approach to make this work is to offer an operation that projects any Element type to a new crs and secondly to add a crs-aware RGB type to geoviews.

KeyError: Dimension not found, even though dimension exists

Hi,
the code below used to work but has ceased to do so.
For context, working with the following geoviews dataset:

gvDataset.dimensions()
[Dimension('lon'),
Dimension('lat'),
Dimension('experiment'),
Dimension('rrs_unc')]

where
gvDataset['experiment']
array(['O3', 'Pressure', 'WindSpeed', ..., 'Lt', 'All', 'RH'], dtype=object)

then...
image = gvDataset.to(gv.Image, ['lat', 'lon'] ) * gf.land(style=dict(facecolor='gray'))
yields...

KeyError Traceback (most recent call last)
in ()
3 ancMin, ancMax = 1e-6, 1e-4
4 gvDataset = MakeGvDS(band)
----> 5 image = gvDataset.to(gv.Image, geodims) * gf.land(style=dict(facecolor='gray'))
6 layout = hv.NdLayout(image)
7 layout.cols(2)

~/anaconda3/lib/python3.5/site-packages/geoviews/element/init.py in call(self, *args, **kwargs)
24 if 'crs' not in kwargs and issubclass(group_type, _Element):
25 kwargs['crs'] = self._element.crs
---> 26 return super(GeoConversion, self).call(*args, **kwargs)
27
28 def linecontours(self, kdims=None, vdims=None, mdims=None, **kwargs):

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/init.py in call(self, new_type, kdims, vdims, groupby, sort, **kwargs)
132 return element.sort() if sort else element
133 group = selected.groupby(groupby, container_type=HoloMap,
--> 134 group_type=new_type, **params)
135 if sort:
136 return group.map(lambda x: x.sort(), [new_type])

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/init.py in groupby(self, dimensions, container_type, group_type, dynamic, **kwargs)
549
550 return self.interface.groupby(self, dim_names, container_type,
--> 551 group_type, **kwargs)
552
553 def len(self):

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/xarray.py in groupby(cls, dataset, dimensions, container_type, group_type, **kwargs)
123 if drop_dim:
124 v = v.to_dataframe().reset_index()
--> 125 data.append((k, group_type(v, **group_kwargs)))
126 else:
127 unique_iters = [cls.values(dataset, d, False) for d in group_by]

~/anaconda3/lib/python3.5/site-packages/geoviews/element/geo.py in init(self, data, **kwargs)
81 elif crs:
82 kwargs['crs'] = crs
---> 83 super(_Element, self).init(data, **kwargs)
84
85

~/anaconda3/lib/python3.5/site-packages/holoviews/element/raster.py in init(self, data, bounds, extents, xdensity, ydensity, **params)
257 SheetCoordinateSystem.init(self, bounds, xdensity, ydensity)
258
--> 259 if len(self.shape) == 3:
260 if self.shape[2] != len(self.vdims):
261 raise ValueError("Input array has shape %r but %d value dimensions defined"

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/init.py in shape(self)
565 def shape(self):
566 "Returns the shape of the data."
--> 567 return self.interface.shape(self)
568
569

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/grid.py in shape(cls, dataset, gridded)
101 return dataset.data[dataset.vdims[0].name].shape
102 else:
--> 103 return (cls.length(dataset), len(dataset.dimensions()))
104
105

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/xarray.py in length(cls, dataset)
249 @classmethod
250 def length(cls, dataset):
--> 251 return np.product(dataset[dataset.vdims[0].name].shape)
252
253 @classmethod

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/init.py in getitem(self, slices)
377 value_select = None
378 if len(slices) == 1 and slices[0] in self.dimensions():
--> 379 return self.dimension_values(slices[0])
380 elif len(slices) == self.ndims+1 and slices[self.ndims] in self.dimensions():
381 selection = dict(zip(self.dimensions('key', label=True), slices))

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/init.py in dimension_values(self, dim, expanded, flat)
574 """
575 dim = self.get_dimension(dim, strict=True)
--> 576 return self.interface.values(self, dim, expanded, flat)
577
578

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/xarray.py in values(cls, dataset, dim, expanded, flat)
157 if dim in dataset.vdims:
158 coord_dims = dataset.data[dim.name].dims
--> 159 data = cls.canonicalize(dataset, data, coord_dims=coord_dims)
160 return data.T.flatten() if flat else data
161 elif expanded:

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/grid.py in canonicalize(cls, dataset, data, coord_dims)
143 slices = []
144 for d in coord_dims:
--> 145 coords = cls.coords(dataset, d)
146 if np.all(coords[1:] < coords[:-1]):
147 slices.append(slice(None, None, -1))

~/anaconda3/lib/python3.5/site-packages/holoviews/core/data/xarray.py in coords(cls, dataset, dim, ordered, expanded)
142 @classmethod
143 def coords(cls, dataset, dim, ordered=False, expanded=False):
--> 144 dim = dataset.get_dimension(dim, strict=True).name
145 if expanded:
146 return util.expand_grid_coords(dataset, dim)

~/anaconda3/lib/python3.5/site-packages/holoviews/core/dimension.py in get_dimension(self, dimension, default, strict)
892 name_map.update({dimension_sanitizer(dim.name): dim for dim in all_dims})
893 if strict and dimension not in name_map:
--> 894 raise KeyError("Dimension %s not found" % dimension)
895 else:
896 return name_map.get(dimension, default)

KeyError: 'Dimension experiment not found'

Bugs/issues when creating choropleth map from shapefile

I have some bugs/issues when creating maps from shapefile.
Here I use the UK referendum as an example to reproduce these issues.

(1) If there are missing values, the corresponding spatial unit on the map will not be displayed. it would be better to have an option to automatically fill the missing value to display all the spatial unit even though they don't .
case2

(2)If the data type is integer. The map will not show color correctly.
case1

(3) When the data value contains nan, the map looks good. But when these nan values are filled by 0. the resulting map is totally incorrect. (Here I manually assign three nan and fill them by zero)
case3

(4) Latitude and longitude on the map also seem to be problematic.
case3

(5) Better to have way to set color range for these maps.
I am affected mostly by the third issue, because in my study I have to fill some values, otherwise it will become the first issue.

Hope these issues can be fixed or improved.

Code to reproduce these issues is attached. I don't know how to upload jupyter notebook.

import pandas as pd
import numpy as np
import holoviews as hv
import geoviews as gv
import cartopy
from cartopy import crs as ccrs
%pylab

hv.notebook_extension('bokeh','matplotlib')

shapefile = 'boundaries/boundaries.shp'
shapes = cartopy.io.shapereader.Reader(shapefile)

referendum = pd.read_csv('referendum.csv')
referendum['value1'] = referendum['leaveVoteshare']

%%output backend='bokeh'
%%opts Shape (cmap='viridis') [xaxis=None yaxis=None tools=['hover'] width=400 height=500]

# Case 1: set referendum value is interger
referendum_modified = referendum.copy()
referendum_modified['value1'] = referendum_modified['value1'].apply(np.int)

data = hv.Dataset(referendum_modified)

gv.Shape.from_records(shapes.records(), data, on='code', value='value1',
                     index=['name', 'regionName'], crs=ccrs.PlateCarree())

%%output backend='bokeh'
%%opts Shape (cmap='viridis') [xaxis=None yaxis=None tools=['hover'] width=400 height=500]

# Case 2: If referendem values are missing for some counties
referendum_modified = referendum.copy()

referendum_modified = referendum_modified.iloc[0:100,:]

data = hv.Dataset(referendum_modified)

gv.Shape.from_records(shapes.records(), data, on='code', value='value1',
                     index=['name', 'regionName'], crs=ccrs.PlateCarree())

%%output backend='bokeh'
%%opts Shape (cmap='viridis') [xaxis=None yaxis=None tools=['hover'] width=400 height=500]

# Case 3: Here set the fist three rows to nan and fill them with 0   
referendum_modified = referendum.copy()
referendum_modified['value1'][0:3]=np.nan
referendum_modified['value1'] = referendum_modified['value1'].fillna(0)

data = hv.Dataset(referendum_modified)

    
gv.Shape.from_records(shapes.records(), data, on='code', value='value1',
                     index=['name', 'regionName'], crs=ccrs.PlateCarree())

can't import geoviews in Python 3.5

I am trying to use geoviews in Mac OS X 10.7.5. Because of this elderly OS, I have to use Anaconda 4.2 and Python 3.5 rather than the most recent versions. Installing geoviews goes fine, but I can't use it. Here's the error:

(py35) ELD-MacBook-Pro:Desktop EDobbins$ conda install -c conda-forge -c ioam holoviews geoviews
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /Users/EDobbins/anaconda2/envs/py35:

The following NEW packages will be INSTALLED:

    cartopy:   0.15.1-np111py35_2 conda-forge
    geos:      3.5.1-1            conda-forge
    geoviews:  1.3.0-py35_0       ioam       
    holoviews: 1.8.1-py35_0       conda-forge
    lancet:    0.9.0-py35_0       conda-forge
    owslib:    0.14.0-py35_0      conda-forge
    param:     1.5.1-py35_0       conda-forge
    proj4:     4.9.3-4            conda-forge
    pyepsg:    0.3.2-py35_0       conda-forge
    pyproj:    1.9.5.1-py35_0     conda-forge
    pyshp:     1.2.11-py35_0      conda-forge
    shapely:   1.5.17-py35_4      conda-forge

Proceed ([y]/n)? y

param-1.5.1-py 100% |#############################################################| Time: 0:00:00 247.38 kB/s
lancet-0.9.0-p 100% |#############################################################| Time: 0:00:00 182.13 kB/s
holoviews-1.8. 100% |#############################################################| Time: 0:00:02   1.67 MB/s
(py35) ELD-MacBook-Pro:Desktop EDobbins$ python
Python 3.5.2 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:52:12) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import geoviews

ParseException: Unexpected EOF parsing WKB
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/geoviews/__init__.py", line 9, in <module>
    from .element import (_Element, Feature, Tiles,     # noqa (API import)
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/geoviews/element/__init__.py", line 3, in <module>
    from .geo import (_Element, Feature, Tiles, is_geographic,     # noqa (API import)
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/geoviews/element/geo.py", line 3, in <module>
    from cartopy import crs as ccrs
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/cartopy/__init__.py", line 24, in <module>
    import shapely.speedups
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/shapely/speedups/__init__.py", line 3, in <module>
    from shapely.geometry import linestring, polygon
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/shapely/geometry/__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/shapely/geometry/base.py", line 169, in <module>
    EMPTY = deserialize_wkb(a2b_hex(b'010700000000000000'))
  File "/Users/EDobbins/anaconda2/envs/py35/lib/python3.5/site-packages/shapely/geometry/base.py", line 110, in deserialize_wkb
    "Could not create geometry because of errors while reading input.")
shapely.geos.ReadingError: Could not create geometry because of errors while reading input.

Do I have any options here? Is this a known error that can be fixed?

Thanks for any hints.

Make gv an alias for hv in general?

GeoViews provides specialized versions of many of the components available in HoloViews, and in many cases a given HoloViews object "hv.X" can be used in a projection-aware way as "gv.X". However, many items in HoloViews can be used as-is with GeoViews, and thus there is not in general a full set of "gv." versions of the various bits of HoloViews. In practice, it can be difficult for a GeoViews user to remember whether some component has been implemented in GeoViews or in HoloViews, and the resulting code is also often confusing (why does it sometimes say "hv." here, and ".gv" over here?).

I propose that we consider the alternative approach of mirroring all the main items in '.hv" so that they appear in ".gv" if they make sense there, which will make the user not have to worry about where that component was defined, and will make it simpler for us to add GV-specific versions of HV components later.

The first component that comes to mind is hv.extension(), which needs to be in any GV notebook, thus forcing a direct import of HoloViews. If that function were imported into the geoviews namespace, then users could just call gv.extension(), and someday if we wanted to add some GV-specific extension arguments we could easily do so.

Broken aspect in a Dynamic map

Given a single surface_temperature map called frame, the following DynamicMap definition has a very strange aspect and doesn't seem to be working right.

surface_temp = iris.load_cube(iris.sample_data_path('GloSea4', 'ensemble_001.pp'))
frame = hv.Dataset(surface_temp).groupby(['time'], group_type=gv.Image).last

def callback(latitude, longitude):
    return frame * hv.HLine(latitude) * hv.VLine(longitude)

hv.DynamicMap(callback, kdims=[hv.Dimension('latitude', range=(-90.0,90.0)), 
                               hv.Dimension('longitude', range=(-150.0, 150.0))])

It looks fine if you only look at a single overlay.

Add basemap to the bokeh EU Referendum example?

Hi, I am new and trying to apply geoviews to my project.

Is it possible to add a basemap tile to the Bokeh 'EU Referendum' example notebook?

I've tried simply ' * ' a base map tile and a bokeh map, like this:

bokeh_map = gv.Shape.from_records(shapes.records(), hv_data, on='ID', value='POP',
                     index=['ID'], crs=ccrs.PlateCarree()))
base_map = gv.WMTS(WMTSTileSource(url='http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png'), 
                     crs=ccrs.PlateCarree())
bokeh_map * base_map

and then I got an error:

TypeError: 'odict_values' object does not support indexing

as well as the output:

:Overlay
   .NdOverlay.Area :NdOverlay   [CLASS_ID]
      :Shape   [Longitude,Latitude]   (AREA)
   .WMTS.I         :WMTS   [Longitude,Latitude]

Thanks for any hint!

Question-asking location

Hi. I am excited about the possibility of using geoviews to display some analysis of mine for a project. I am doing my best to follow the examples but am meeting a lot of walls. Where might I go to have a conversation about how to use this tool?
Thanks for the great work!
Kristen

Geoviews tutorial doesn't run 'Bokeh' 'Figure' object has no attribute 'set'

I'm stuck in the tutorial and I don't know where it went wrong.
Version bokeh 0.12.5dev-py36_0
geoviews 1.2.0dev1
Windows env.

thnx!

https://www.continuum.io/blog/developer-blog/introducing-geoviews

%%output backend='bokeh'
%%opts Overlay [width=600 height=500 xaxis=None yaxis=None] Feature.Lines (line_color='gray' line_width=0.5)
features


AttributeError Traceback (most recent call last)
C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\formatters.py in call(self, obj)
305 pass
306 else:
--> 307 return printer(obj)
308 # Finally look for special method names
309 method = get_real_method(obj, self.print_method)

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
214 if not ip.display_formatter.formatters['text/plain'].pprint:
215 return None
--> 216 return display(obj, raw=True)
217
218

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw, **kwargs)
196 html = grid_display(obj)
197 elif isinstance(obj, (CompositeOverlay, ViewableElement)):
--> 198 html = element_display(obj)
199 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
200 html = layout_display(obj)

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
101 html = fn(element,
102 max_frames=OutputMagic.options['max_frames'],
--> 103 max_branches = OutputMagic.options['max_branches'])
104
105 # Only want to add to the archive for one display hook...

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in element_display(element, max_frames, max_branches)
142 return None
143 renderer = Store.renderers[backend]
--> 144 return renderer.html(element, fmt=renderer.fig)
145
146

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in html(self, obj, fmt, css)
248 Renders plot or data structure and wraps the output in HTML.
249 """
--> 250 plot, fmt = self._validate(obj, fmt)
251 figdata, _ = self(plot, fmt)
252 if css is None: css = self.css

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in _validate(self, obj, fmt)
188 if isinstance(obj, tuple(self.widgets.values())):
189 return obj, 'html'
--> 190 plot = self.get_plot(obj)
191
192 fig_formats = self.mode_formats['fig'][self.mode]

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj)
175 plot_opts = self_or_cls.plot_options(obj, self_or_cls.size)
176 plot = self_or_cls.plotting_class(obj)(obj, **plot_opts)
--> 177 plot.update(0)
178 else:
179 plot = obj

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\plot.py in update(self, key)
469 def update(self, key):
470 if len(self) == 1 and key == 0 and not self.drawn:
--> 471 return self.initialize_plot()
472 return self.getitem(key)
473

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots)
812 self._init_axes(plot)
813 if plot and not self.overlaid:
--> 814 self._update_plot(key, plot, element)
815 self.handles['plot'] = plot
816

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\bokeh\element.py in _update_plot(self, key, plot, element)
393 el = element.traverse(lambda x: x, [Element])
394 dimensions = el[0].dimensions() if el else el.dimensions()
--> 395 plot.set(**self._plot_properties(key, plot, element))
396 props = {axis: self._axis_properties(axis, key, plot, dim)
397 for axis, dim in zip(['x', 'y'], dimensions)}

AttributeError: 'Figure' object has no attribute 'set'

Out[67]:
:Overlay
.Ocean.I :Feature [Longitude,Latitude]
.Land.I :Feature [Longitude,Latitude]
.Lines.I :Feature [Longitude,Latitude]
.Rivers.I :Feature [Longitude,Latitude]
.Lakes.I :Feature [Longitude,Latitude]
.Borders.I :Feature [Longitude,Latitude]
.Coastline.I :Feature [Longitude,Latitude]

holoviews/geoviews notebook extension problem

When notebook extension is matplotlib values in holoviews table changes on selection

image

When notebook extension is bokeh and matplotlib, values in holoviews table does not changes and only geoviews points values changes . Help required holoviews table and geoviews points values both changes upon selection.

image

plot dataset with 2D coordinate variables

I have an xarray dataset with the following structure:

<xarray.Dataset>
Dimensions:   (face: 13, i: 4320, j: 4320,  k: 90, time: 1)
Coordinates:
  * k         (k) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
  * j         (j) float64 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 ...
  * i         (i) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
  * face      (face) int64 0 1 2 3 4 5 6 7 8 9 10 11 12
    iter      (time) int64 487152
  * time      (time) int64 487152
    XC        (face, j, i) >f4 -114.932 -114.932 -114.932 -114.932 -114.932 ...
    YC        (face, j, i) >f4 -88.1771 -88.1801 -88.183 -88.1859 -88.1888 ...
    Z         (k) >f4 -0.5 -1.57 -2.79 -4.185 -5.78 -7.595 -9.66 -12.01 ...
Data variables:
    Theta     (time, k, face, j, i) >f4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...
    Salt      (time, k, face, j, i) >f4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...

This is an enormous dataset from a ocean simulation using a faceted curvilinear grid. The longitudes latitudes, and depths of the data are encoded by the variables 'XC' and 'YC'.

I am trying, unsuccessfully, to use geoviews to visualize this data. Here is what I am doing:

import geoviews as gv
gvds_from_xr = gv.Dataset(ds, kdims=['XC', 'YC', 'Z', 'time'], vdims=['Theta', 'Salt'])
gvds_from_xr.to(gv.Image, ['XC', 'YC'])

This raises the error

ValueError: dimensions or multi-index levels ['Z'] do not exist

If I try

gvds_from_xr = gv.Dataset(ds, kdims=['XC', 'YC', 'k', 'time'], vdims=['Theta', 'Salt'])
gvds_from_xr.to(gv.Image, ['XC', 'YC'])

(replacing physical dimension 'Z' with logical dimension 'k') I get the following stack trace:

ValueErrorTraceback (most recent call last)
<ipython-input-27-02d44a5c1c08> in <module>()
      2 get_ipython().magic(u"time gvds_from_xr = gv.Dataset(ds, kdims=['XC', 'YC', 'k', 'time'], vdims=['Theta', 'Salt'])")
      3 print(gvds_from_xr)
----> 4 get_ipython().magic(u"time gvds_from_xr.to(gv.Image, ['XC', 'YC'])")

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2156         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2157         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158         return self.run_line_magic(magic_name, magic_arg_s)
   2159 
   2160     #-------------------------------------------------------------------------

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2077                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2078             with self.builtin_trap:
-> 2079                 result = fn(*args,**kwargs)
   2080             return result
   2081 

<decorator-gen-59> in time(self, line, cell, local_ns)

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
   1174         if mode=='eval':
   1175             st = clock2()
-> 1176             out = eval(code, glob, local_ns)
   1177             end = clock2()
   1178         else:

<timed eval> in <module>()

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/geoviews/element/__init__.pyc in __call__(self, *args, **kwargs)
     24         if 'crs' not in kwargs and issubclass(group_type, _Element):
     25             kwargs['crs'] = self._element.crs
---> 26         return super(GeoConversion, self).__call__(*args, **kwargs)
     27 
     28     def linecontours(self, kdims=None, vdims=None, mdims=None, **kwargs):

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/data/__init__.pyc in __call__(self, new_type, kdims, vdims, mdims, sort, **kwargs)
     92             return element.sort() if sort else element
     93         group = selected.groupby(mdims, container_type=HoloMap,
---> 94                                  group_type=new_type, **params)
     95         if sort:
     96             return group.map(lambda x: x.sort(), [new_type])

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/data/__init__.pyc in groupby(self, dimensions, container_type, group_type, dynamic, **kwargs)
    409 
    410         return self.interface.groupby(self, dim_names, container_type,
--> 411                                       group_type, **kwargs)
    412 
    413     def __len__(self):

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/data/xarray.pyc in groupby(cls, dataset, dimensions, container_type, group_type, **kwargs)
    110             data = [(k, group_type(dataset.data.sel(**dict(zip(dimensions, k))),
    111                                    **group_kwargs))
--> 112                     for k in indexes]
    113 
    114         if issubclass(container_type, NdMapping):

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/geoviews/element/geo.pyc in __init__(self, data, **kwargs)
     83         elif crs:
     84             kwargs['crs'] = crs
---> 85         super(_Element, self).__init__(data, **kwargs)
     86 
     87 

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/element/raster.pyc in __init__(self, data, **params)
    657 
    658     def __init__(self, data, **params):
--> 659         super(GridImage, self).__init__(data, **params)
    660         (l, r), (b, t) = self.interface.range(self, 0), self.interface.range(self, 1)
    661         (ys, xs) = self.dimension_values(2, flat=False).shape

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/data/__init__.pyc in __init__(self, data, **kwargs)
    135                                            datatype=kwargs.get('datatype'))
    136         (data, self.interface, dims, extra_kws) = initialized
--> 137         super(Dataset, self).__init__(data, **dict(extra_kws, **dict(kwargs, **dims)))
    138         self.interface.validate(self)
    139 

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/dimension.pyc in __init__(self, data, **params)
    593                                   for d in params.pop(group)]
    594                 params[group] = dimensions
--> 595         super(Dimensioned, self).__init__(data, **params)
    596         self.ndims = len(self.kdims)
    597         cdims = [(d.name, val) for d, val in self.cdims.items()]

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/holoviews/core/dimension.pyc in __init__(self, data, id, **params)
    297             params['group'] = long_name
    298 
--> 299         super(LabelledData, self).__init__(**params)
    300         if not group_sanitizer.allowable(self.group):
    301             raise ValueError("Supplied group %r contains invalid characters." %

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/param/parameterized.pyc in __init__(self, **params)
   1039         self.__generate_name()
   1040 
-> 1041         self._setup_params(**params)
   1042         object_count += 1
   1043 

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/param/parameterized.pyc in override_initialization(parameterized_instance, *args, **kw)
    976         original_initialized=parameterized_instance.initialized
    977         parameterized_instance.initialized=False
--> 978         fn(parameterized_instance,*args,**kw)
    979         parameterized_instance.initialized=original_initialized
    980     return override_initialization

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/param/parameterized.pyc in _setup_params(self, **params)
   1439                 self.warning("Setting non-parameter attribute %s=%s using a mechanism intended only for parameters",name,val)
   1440             # i.e. if not desc it's setting an attribute in __dict__, not a Parameter
-> 1441             setattr(self,name,val)
   1442 
   1443 

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/param/__init__.pyc in __set__(self, obj, val)
   1151     def __set__(self,obj,val):
   1152         """Set to the given value, raising an exception if out of bounds."""
-> 1153         self._check_bounds(val)
   1154         super(List,self).__set__(obj,val)
   1155 

/home/rpa/.conda/envs/lagrangian_vorticity/lib/python2.7/site-packages/param/__init__.pyc in _check_bounds(self, val)
   1170             if min_length is not None and max_length is not None:
   1171                 if not (min_length <= l <= max_length):
-> 1172                     raise ValueError("%s: list length must be between %s and %s (inclusive)"%(self._attrib_name,min_length,max_length))
   1173             elif min_length is not None:
   1174                 if not min_length <= l:

ValueError: vdims: list length must be between 1 and 1 (inclusive)

Clearly I am doing something wrong, but I can't figure out what.

Thanks for any help you can provide.

Multidimensional Coordinate Variables (3D lats/lons)

We have been working on CF-compliant netcdf formats to provide flexible multi resolution (but gridded) input to unstructured hydrodynamic and wave models. xarray appears to support dealing with these files/groups relatively painlessly, and it would be great if we could get support in geoviews which would allow us to demonstrate the capabilities of the format nicely.

Here is an example of a group within a test file:

<xarray.Dataset>
Dimensions:  (time: 168, xi: 25, yi: 25)
Coordinates:
  * time     (time) datetime64[ns] 2017-05-31T12:00:00 2017-05-31T13:00:00 ...
    lon      (time, yi, xi) float64 -180.0 -165.0 -150.0 -135.0 -120.0 ...
    lat      (time, yi, xi) float64 -70.0 -70.0 -70.0 -70.0 -70.0 -70.0 ...
Dimensions without coordinates: xi, yi
Data variables:
    U10      (time, yi, xi) float64 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 ...
    V10      (time, yi, xi) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...
    PSFC     (time, yi, xi) float64 1.015e+03 1.015e+03 1.015e+03 1.015e+03 ...
Attributes:
    rank: 1

This is the test I was attempting:

xr = gv.Dataset(xarray.open_dataset("./test_file.nc", group="region"), 
                kdims=["lon", "lat", "time"], vdims=["PSFC", "U10", "V10"], 
                crs=ccrs.PlateCarree())
xr.to(gv.Image, ['lon', 'lat'], "PSFC", dynamic=True) * gf.coastline

Here is the full traceback (although I understand from Gitter that there are probably bigger issues at play to support a structure like this):

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/alex/.local/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
    305                 pass
    306             else:
--> 307                 return printer(obj)
    308             # Finally look for special method names
    309             method = get_real_method(obj, self.print_method)

/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.pyc in pprint_display(obj)
    255     if not ip.display_formatter.formatters['text/plain'].pprint:
    256         return None
--> 257     return display(obj, raw=True)
    258 
    259 

/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.pyc in display(obj, raw, **kwargs)
    241     elif isinstance(obj, (HoloMap, DynamicMap)):
    242         with option_state(obj):
--> 243             html = map_display(obj)
    244     else:
    245         return repr(obj) if raw else IPython.display.display(obj, **kwargs)

/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.pyc in wrapped(element)
    127         try:
    128             html = fn(element,
--> 129                       max_frames=OutputMagic.options['max_frames'])
    130 
    131             # Only want to add to the archive for one display hook...

/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.pyc in map_display(vmap, max_frames)
    196         return None
    197 
--> 198     return render(vmap)
    199 
    200 

/usr/local/lib/python2.7/dist-packages/holoviews/ipython/display_hooks.pyc in render(obj, **kwargs)
     57     if renderer.fig == 'pdf':
     58         renderer = renderer.instance(fig='png')
---> 59     return renderer.html(obj, **kwargs)
     60 
     61 

/usr/local/lib/python2.7/dist-packages/holoviews/plotting/renderer.pyc in html(self, obj, fmt, css, comm, **kwargs)
    253         code to initialize a Comm, if the plot supplies one.
    254         """
--> 255         plot, fmt =  self._validate(obj, fmt)
    256         figdata, _ = self(plot, fmt, **kwargs)
    257         if css is None: css = self.css

/usr/local/lib/python2.7/dist-packages/holoviews/plotting/renderer.pyc in _validate(self, obj, fmt)
    189         if isinstance(obj, tuple(self.widgets.values())):
    190             return obj, 'html'
--> 191         plot = self.get_plot(obj, renderer=self)
    192 
    193         fig_formats = self.mode_formats['fig'][self.mode]

/usr/local/lib/python2.7/dist-packages/holoviews/plotting/renderer.pyc in get_plot(self_or_cls, obj, renderer)
    164         """
    165         # Initialize DynamicMaps with first data item
--> 166         initialize_dynamic(obj)
    167 
    168         if not isinstance(obj, Plot) and not displayable(obj):

/usr/local/lib/python2.7/dist-packages/holoviews/plotting/util.pyc in initialize_dynamic(obj)
    173             continue
    174         if not len(dmap):
--> 175             dmap[dmap._initial_key()]
    176 
    177 

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in __getitem__(self, key)
    942         # Not a cross product and nothing cached so compute element.
    943         if cache is not None: return cache
--> 944         val = self._execute_callback(*tuple_key)
    945         if data_slice:
    946             val = self._dataslice(val, data_slice)

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in _execute_callback(self, *args)
    791 
    792         with dynamicmap_memoization(self.callback, self.streams):
--> 793             retval = self.callback(*args, **kwargs)
    794         return self._style(retval)
    795 

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in __call__(self, *args, **kwargs)
    519 
    520         try:
--> 521             ret = self.callable(*args, **kwargs)
    522         except:
    523             posstr = ', '.join(['%r' % el for el in inargs]) if inargs else ''

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in dynamic_mul(*args, **kwargs)
    207             if isinstance(self, DynamicMap):
    208                 def dynamic_mul(*args, **kwargs):
--> 209                     element = self[args]
    210                     return element * other
    211                 callback = Callable(dynamic_mul, inputs=[self, other])

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in __getitem__(self, key)
    942         # Not a cross product and nothing cached so compute element.
    943         if cache is not None: return cache
--> 944         val = self._execute_callback(*tuple_key)
    945         if data_slice:
    946             val = self._dataslice(val, data_slice)

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in _execute_callback(self, *args)
    791 
    792         with dynamicmap_memoization(self.callback, self.streams):
--> 793             retval = self.callback(*args, **kwargs)
    794         return self._style(retval)
    795 

/usr/local/lib/python2.7/dist-packages/holoviews/core/spaces.pyc in __call__(self, *args, **kwargs)
    519 
    520         try:
--> 521             ret = self.callable(*args, **kwargs)
    522         except:
    523             posstr = ', '.join(['%r' % el for el in inargs]) if inargs else ''

/usr/local/lib/python2.7/dist-packages/holoviews/core/data/__init__.pyc in load_subset(*args)
    543                 if drop_dim and self.interface.gridded:
    544                     data = data.columns()
--> 545                 return group_type(data, **group_kwargs)
    546             dynamic_dims = [d(values=list(self.interface.values(self, d.name, False)))
    547                             for d in dimensions]

/usr/local/lib/python2.7/dist-packages/geoviews/element/geo.pyc in __init__(self, data, **kwargs)
     81         elif crs:
     82             kwargs['crs'] = crs
---> 83         super(_Element, self).__init__(data, **kwargs)
     84 
     85 

/usr/local/lib/python2.7/dist-packages/holoviews/element/raster.pyc in __init__(self, data, bounds, extents, xdensity, ydensity, **params)
    242         if bounds is None:
    243             xvals = self.dimension_values(0, False)
--> 244             l, r, xdensity, _ = util.bound_range(xvals, xdensity)
    245             yvals = self.dimension_values(1, False)
    246             b, t, ydensity, _ = util.bound_range(yvals, ydensity)

/usr/local/lib/python2.7/dist-packages/holoviews/core/util.pyc in bound_range(vals, density)
   1375     low, high = vals.min(), vals.max()
   1376     invert = False
-> 1377     if vals[0] > vals[1]:
   1378         invert = True
   1379     if not density:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

:DynamicMap   [time]

Versions I am currently using if it's relevant:

geoviews==1.2.0
holoviews==1.7.0
xarray==0.9.1

Coordinate offset with WMTS

I tried to put a point (and subsequently a raster) over a wmts basemap, but canยดt get it into the correct place.

The wmts is WebMercator (epsg 3857)
The point coordinates taken directly from the basemap.at viewer:
image

%%output backend='bokeh'
%%opts WMTS [width=600 height=400]
%%opts Points [tools=['hover'] ] (size=5.5)

url ='https://maps.wien.gv.at/basemap/bmapgrau/normal/google3857/{z}/{y}/{x}.png'
extents=(1795000,6075000,1818000,6090000)
geomap = gv.WMTS(WMTSTileSource(url=url), extents=extents, crs=crs.Mercator())
# location
baden = gv.Points((1807575,6108479),crs=crs.Mercator())

geomap * baden 

the point is about 35km to the north:
image

also, is there a way to format the coordinates in meters (like axis.formatter from bokeh) or suppress the scientific coordinate notation (something like np.set_printoptions(suppress=True) )?

on windows 64 bit

on windows 64 bit i install i apply the following commands

conda create --name geoviews jupyter xarray
source activate geoviews
conda install -c scitools/label/dev -c conda-forge -c ioam holoviews geoviews iris cartopy

(geoviews) D:\Anaconda\envs\geoviews>python.exe
Python 2.7.12 | packaged by conda-forge | (default, Sep 8 2016, 14:46:05) [MSC
v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import geoviews
Traceback (most recent call last):
File "", line 1, in
File "D:\Anaconda\envs\geoviews\lib\site-packages\geoviews__init__.py", line
9, in
from .element import (Element, Feature, Tiles, # noqa (API import)
File "D:\Anaconda\envs\geoviews\lib\site-packages\geoviews\element__init_.py
", line 3, in
from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API i
mport)
File "D:\Anaconda\envs\geoviews\lib\site-packages\geoviews\element\geo.py", li
ne 9, in
from holoviews.element import (Text as HVText, Path as HVPath,
ImportError: cannot import name GridImage
Kindly help.

Bad link in documentation

In the Working with Bokeh Tutorial on the website, the link "The tutorial on Geometries" (first sentence of the "Chloropleths" section) is broken; it points to the .ipynb file (prompting a download) instead of the rendered HTML version.

problems with geoviews bokeh backend

I was trying to work through the geoviews bokeh backend examples (http://geo.holoviews.org/Working_with_Bokeh.html)

The "WMTS Tile Sources" example fails with:
AttributeError:'TileRenderer' object has no attribute 'set'

The "Plotting Data " example fails with:
AttributeError: 'Figure' object has no attribute 'set'

I have a python3.6 Anaconda distribution (with bokeh 0.12.4) , and installed geoviews 1.2.0dev1, holoviews 1.6.2 using conda. On a machine running macOS 10.12.3.
Note that although the conda install was for geoviews 1.2.0dev1, the version yields 1.1.0.
I can provide more complete tracebacks (they are lengthy) if needed.

I am at a loss, there appears to be some problem in invoking bokeh.

holoviews.element.raster.GridImage class missing

The installation seemed to be fine, but when I import the code I get an import error related to GridImage in the initialization line:

from holoviews.element import (Text as HVText, Path as HVPath, Polygons as HVPolygons, GridImage)

Looking in the holoview package under element/raster.py, where GridImage is supposed to be (according to http://dev.holoviews.org/Reference_Manual/holoviews.element.html), there is no GridImage class. All the other classes from the link that are supposed to be there are present. Not sure why this bit of code is missing.

Inconsistent xarray dimensions use between holoviews and geoviews

The same data is being plotted differently into an Image using either holoviews or geoviews.
Is this related to how geoviews uses boundaries, a mention I find in just one line of the docs of geoviews when comparing to the Iris library?

Here's how I create the datasets:

kdims = ['simtime', 'lyr_mid', ('lon', 'Longitude'), ('lat','Latitude')]
vdims = ['wind_mag', 'wind_dir']
xr_dataset = gv.Dataset(xr_ensemble, kdims=kdims, vdims=vdims, crs=crs.PlateCarree())
hv_dataset = hv.Dataset(xr_ensemble, kdims=kdims, vdims=vdims)

Here's the geoviews Image plot:

%%opts Image [aspect=1.5]
xr_dataset.select(simtime=(24096,24098)).to(gv.Image, ['lon', 'lat'], 'wind_mag')

screenshot 2017-07-29 16 12 08

and here the holoviews Image plot:

%%opts Image [aspect=1.5]
hv_dataset.select(simtime=(24096,24098)).to(hv.Image, ['lon', 'lat'], 'wind_mag')

screenshot 2017-07-29 16 13 24

As you can see the latitude has 4 bins, and all bins are shown in the holoviews Image plot, but the geoviews Image plot is using the value of the first latitude dimension, 70, as a boundary instead of centering the bin around that number, which is how this netCDF data was compiled.

How can I make geoviews treat the data the same way holoviews already does?

Here's the .coords view of the xarray object:

Coordinates:
  * lyr_mid  (lyr_mid) float64 0.992 0.9975 0.9995
  * lon      (lon) float64 -180.0 -174.0 -168.0 -162.0 -156.0 -150.0 -144.0 ...
  * lat      (lat) float64 -85.0 -80.0 -75.0 -70.0
  * simtime  (simtime) float64 2.41e+04 2.41e+04 2.41e+04 2.41e+04 2.41e+04 ...

My system data:

  • macOS 10.12.5
  • python 3.6 using conda-forge, all current versions
  • geoviews via the ioam channel
  • Chrome Browser Version 59.0.3071.115 (Official Build) (64-bit)

Shape.from_records should accept pandas DataFrame

When trying to use from_records to merge shape records with a dataframe I get:

/Users/<>/miniconda3/envs/science/lib/python3.5/site-packages/geoviews/element/geo.py in from_records(cls, records, dataset, on, value, index, **kwargs)
    316         Returns an NdOverlay of Shapes.
    317         """
--> 318         if dataset and not on:
    319             raise ValueError('To merge dataset with shapes mapping '
    320                              'must define attribute(s) to merge on.')

/Users/<>/miniconda3/envs/science/lib/python3.5/site-packages/pandas/core/generic.py in __nonzero__(self)
    915         raise ValueError("The truth value of a {0} is ambiguous. "
    916                          "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
--> 917                          .format(self.__class__.__name__))
    918 
    919     __bool__ = __nonzero__

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Scale of NaturalEarthFeature is ignored (always plotting coarse)

Using Geoviews 1.1.0, I have the problem that the scale of any NaturalEarthFeature from cartopy seems to be ignored.

from cartopy.feature import NaturalEarthFeature
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
%matplotlib inline
import holoviews as hv
import geoviews as gv
hv.notebook_extension()
import xarray as xr

I am using the sample data file from https://github.com/SciTools/iris-sample-data/blob/master/iris_sample_data/sample_data/E1_north_america.nc?raw=true

ds = xr.open_dataset('E1_north_america.nc')
arr = ds['air_temperature'][0]
gvds = gv.Dataset(
        arr.to_dataset(), kdims=['longitude', 'latitude'],
        vdims=['air_temperature'])

I define a function to return the correct coastline feature for a given scale, just to be sure to use the same objects in both matplotlib and geoviews cases:

def coastline(scale):
    return NaturalEarthFeature(
            category='physical', name='coastline', scale=scale,
            edgecolor='black', facecolor='none')

Using pure matplotlib, everything works as expected:

fig, axs = plt.subplots(
        figsize=(8, 15), nrows=3,
        subplot_kw=dict(projection=ccrs.PlateCarree()))

for ax, scale in zip(axs, ['10m', '50m', '110m']):
    arr.plot.pcolormesh(ax=ax, x='longitude', y='latitude', 
                    transform=ccrs.PlateCarree())
    ax.add_feature(coastline(scale))
    ax.set_title('Scale: {}'.format(scale))

img_matplotlib

However, when using Geoviews, it seems like always the 110m scale is displayed, even though I'm using a higher resolution feature:

%%output backend='matplotlib' size=450

def create_overlay(ds, scale):
    return hv.Overlay([
            ds.to(gv.Image, ['longitude', 'latitude']).relabel(scale),
            gv.Feature(coastline(scale)),
            ]).collate()

plots = [create_overlay(gvds, sc) for sc in ['10m', '50m', '110m']]
hv.Layout(plots).cols(1)

img_geoviews

mfdataset + dask

Dataset:

<xarray.Dataset>
Dimensions:    (latitude: 721, longitude: 1440, time: 48)
Coordinates:
  * longitude  (longitude) float32 -180.0 -179.75 -179.5 -179.25 -179.0 ...
  * latitude   (latitude) float32 90.0 89.75 89.5 89.25 89.0 88.75 88.5 ...
  * time       (time) datetime64[ns] 2016-10-04 2016-10-04T01:00:00 ...
Data variables:
    dl         (time, latitude, longitude) float64 4.148e+03 4.148e+03 ...
Attributes:
    Conventions:  CF-1.6
    history:      2017-10-04 17:02:08 GMT by grib_to_netcdf-2.4.0: grib_to_ne...

Code:

%%opts Image [colorbar=True fig_size=200] (cmap='viridis')
era5ds = xarray.open_mfdataset('era5_lake/era5_lake*.nc')
dataset = gv.Dataset(era5ds, 
                     kdims=['longitude', 'latitude','time'],
                     crs=ccrs.PlateCarree())
dataset.to(gv.Image, ['longitude', 'latitude'], ['dl'], ['time']) * gf.coastline()

Note: This works when I open a single file, but fails with mfdataset. Likely due to dask.

Error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-10-6f19e70dee21> in <module>()
      3                      kdims=['longitude', 'latitude','time'],
      4                      crs=ccrs.PlateCarree())
----> 5 dataset.to(gv.Image, ['longitude', 'latitude'], ['dl'], ['time']) * gf.coastline()

~/miniconda3/envs/dp/lib/python3.6/site-packages/geoviews/element/__init__.py in __call__(self, *args, **kwargs)
     24         if 'crs' not in kwargs and issubclass(group_type, _Element):
     25             kwargs['crs'] = self._element.crs
---> 26         return super(GeoConversion, self).__call__(*args, **kwargs)
     27 
     28     def linecontours(self, kdims=None, vdims=None, mdims=None, **kwargs):

~/miniconda3/envs/dp/lib/python3.6/site-packages/holoviews/core/data/__init__.py in __call__(self, new_type, kdims, vdims, groupby, sort, **kwargs)
    132             return element.sort() if sort else element
    133         group = selected.groupby(groupby, container_type=HoloMap,
--> 134                                  group_type=new_type, **params)
    135         if sort:
    136             return group.map(lambda x: x.sort(), [new_type])

~/miniconda3/envs/dp/lib/python3.6/site-packages/holoviews/core/data/__init__.py in groupby(self, dimensions, container_type, group_type, dynamic, **kwargs)
    561 
    562         return self.interface.groupby(self, dim_names, container_type,
--> 563                                       group_type, **kwargs)
    564 
    565     def __len__(self):

~/miniconda3/envs/dp/lib/python3.6/site-packages/holoviews/core/data/xarray.py in groupby(cls, dataset, dimensions, container_type, group_type, **kwargs)
    129         data = []
    130         if len(dimensions) == 1:
--> 131             for k, v in dataset.data.groupby(index_dims[0].name):
    132                 if drop_dim:
    133                     v = v.to_dataframe().reset_index()

~/miniconda3/envs/dp/lib/python3.6/site-packages/xarray/core/groupby.py in _iter_grouped(self)
    296         """Iterate over each element in this group"""
    297         for indices in self._group_indices:
--> 298             yield self._obj.isel(**{self._group_dim: indices})
    299 
    300     def _infer_concat_args(self, applied_example):

~/miniconda3/envs/dp/lib/python3.6/site-packages/xarray/core/dataset.py in isel(self, drop, **indexers)
   1141         for name, var in iteritems(self._variables):
   1142             var_indexers = dict((k, v) for k, v in indexers if k in var.dims)
-> 1143             new_var = var.isel(**var_indexers)
   1144             if not (drop and name in var_indexers):
   1145                 variables[name] = new_var

~/miniconda3/envs/dp/lib/python3.6/site-packages/xarray/core/variable.py in isel(self, **indexers)
    568             if dim in indexers:
    569                 key[i] = indexers[dim]
--> 570         return self[tuple(key)]
    571 
    572     def squeeze(self, dim=None):

~/miniconda3/envs/dp/lib/python3.6/site-packages/xarray/core/variable.py in __getitem__(self, key)
    398         dims = tuple(dim for k, dim in zip(key, self.dims)
    399                      if not isinstance(k, integer_types))
--> 400         values = self._indexable_data[key]
    401         # orthogonal indexing should ensure the dimensionality is consistent
    402         if hasattr(values, 'ndim'):

~/miniconda3/envs/dp/lib/python3.6/site-packages/xarray/core/indexing.py in __getitem__(self, key)
    496                 value = value[(slice(None),) * axis + (subkey,)]
    497         else:
--> 498             value = self.array[key]
    499         return value
    500 

~/miniconda3/envs/dp/lib/python3.6/site-packages/dask/array/core.py in __getitem__(self, index)
   1220 
   1221         from .slicing import normalize_index, slice_with_dask_array
-> 1222         index2 = normalize_index(index, self.shape)
   1223 
   1224         if any(isinstance(i, Array) for i in index2):

~/miniconda3/envs/dp/lib/python3.6/site-packages/dask/array/slicing.py in normalize_index(idx, shape)
    760     idx = idx + (slice(None),) * (len(shape) - n_sliced_dims)
    761     if len([i for i in idx if i is not None]) > len(shape):
--> 762         raise IndexError("Too many indices for array")
    763 
    764     none_shape = []

IndexError: Too many indices for array

Using Image and Line/FilledContours for non-geographic plots

Until we have fully integrated the Image in HoloViews with the data interfaces the existing geoviews Image and Contours plots should also support plotting non-geographic data. Currently this works but has two major issues:

  1. The iris plotting calls do not respect the order of dimensions resulting in mislabeling of the axes.

  2. The aspect on these plot types is set to 'equal' by default which is sensible for 'longitude' and 'latitude' since those exist in the same space but often results in very wide or tall plots.

The aspect issue should be easy enough to fix as we can just detect whether a plot is geographic using the is_geographic utility function in geoviews.element.geo and set the aspect accordingly.

The axis mislabeling is more problematic as it will require us to make changes to iris plotting functions so we can respect the order of coordinates in the cube if desired.

segmentation fault when importing geoviews

I am trying to run geoviews within the following conda environment.

name: geo_scipy
channels:
    - conda-forge
    - defaults
    - ioam
dependencies:
    - python=3.6    # Python version 3.6
    - bottleneck    # C-optimized array functions for NumPy
    - cartopy       # Geographic plotting toolkit
    - cython        # Transpile Python->C
    - dask          # Parallel processing library
    - future        # Python 2/3 compatibility
    - h5py          # Wrapper for HDF5
    - ipython       # IPython interpreter and tools
    - jupyter       # Jupyter federation architecture
    - matplotlib    # 2D plotting library
    - netcdf4       # Wrapper for netcdf4
    - notebook      # Notebook interface
    - numpy         # N-d array and numerics
    - pandas        # Labeled array library
    - pyresample    # Geographic resampling tools
    - scipy         # Common math/stats/science functions
    - scikit-learn  # Macine learning library
    - scikit-image  # Image processing routines
    - statsmodels   # Regression/modeling toolkit
    - seaborn       # Statistical visualizations
    - six           # Python 2/3 compatibility
    - tqdm          # Nice progressbar for longer computations
    - xarray        # N-d labeled array library
    - nb_conda
    - holoviews
    - geoviews
    - gsw

I activate the enviroment and run python -c 'import geoviews'. I get the following segfault.

Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.
Abort trap: 6

Note that this does work if I create an environment just for geoviews, i.e.

conda create --name geoviews_test -c conda-forge -c ioam holoviews geoviews

So something about the environment above is causing some sort of library conflict.

The full conda env dump is below

# packages in environment at /Users/rpa/anaconda/envs/geo_scipy:
#
appnope                   0.1.0                    py36_0    conda-forge
asn1crypto                0.22.0                   py36_0    conda-forge
bkcharts                  0.2                      py36_0    conda-forge
blas                      1.1                    openblas    conda-forge
bleach                    2.0.0                    py36_0    conda-forge
bokeh                     0.12.6                   py36_0    conda-forge
bottleneck                1.2.1               np113py36_0    conda-forge
ca-certificates           2017.7.27.1                   0    conda-forge
cartopy                   0.15.1                   py36_4    conda-forge
certifi                   2017.7.27.1              py36_0    conda-forge
cffi                      1.10.0                   py36_0    conda-forge
chardet                   3.0.4                    py36_0    conda-forge
click                     6.7                      py36_0    conda-forge
cloudpickle               0.4.0                    py36_0    conda-forge
configobj                 5.0.6                    py36_0  
cryptography              2.0.3                    py36_0    conda-forge
curl                      7.54.1                        0    conda-forge
cycler                    0.10.0                   py36_0    conda-forge
cython                    0.26                     py36_0    conda-forge
dask                      0.15.2                   py36_0    conda-forge
dask-core                 0.15.2                   py36_0    conda-forge
decorator                 4.1.2                    py36_0    conda-forge
distributed               1.18.3                   py36_0    conda-forge
entrypoints               0.2.3                    py36_1    conda-forge
freetype                  2.7                           1    conda-forge
future                    0.16.0                   py36_0    conda-forge
geos                      3.5.1                         1    conda-forge
geoviews                  1.3.2                    py36_0    ioam
gsw                       3.1.1               np113py36_0    conda-forge
h5netcdf                  0.4.1                      py_0    conda-forge
h5py                      2.7.1                    py36_1    conda-forge
hdf4                      4.2.12                        0    conda-forge
hdf5                      1.8.18                        0    conda-forge
heapdict                  1.0.0                    py36_0    conda-forge
holoviews                 1.8.3                    py36_0    conda-forge
html5lib                  0.999999999              py36_0    conda-forge
icu                       58.1                          1    conda-forge
idna                      2.5                      py36_0    conda-forge
imageio                   2.2.0                    py36_0    conda-forge
ipykernel                 4.6.1                    py36_0    conda-forge
ipython                   6.1.0                    py36_0    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                7.0.0                    py36_1    conda-forge
jedi                      0.10.2                   py36_0    conda-forge
jinja2                    2.9.6                    py36_0    conda-forge
jpeg                      9b                            0    conda-forge
jsonschema                2.6.0                    py36_0    conda-forge
jupyter                   1.0.0                    py36_0    conda-forge
jupyter_client            5.1.0                    py36_0    conda-forge
jupyter_console           5.1.0                    py36_0    conda-forge
jupyter_core              4.3.0                    py36_0    conda-forge
krb5                      1.14.2                        0    conda-forge
lancet                    0.9.0                    py36_0    conda-forge
libffi                    3.2.1                         3    conda-forge
libgfortran               3.0.0                         0    conda-forge
libiconv                  1.14                          4    conda-forge
libnetcdf                 4.4.1.1                       5    conda-forge
libpng                    1.6.28                        0    conda-forge
libsodium                 1.0.10                        0    conda-forge
libssh2                   1.8.0                         1    conda-forge
libtiff                   4.0.6                         7    conda-forge
libxml2                   2.9.4                         4    conda-forge
libxslt                   1.1.29                        5    conda-forge
locket                    0.2.0                    py36_1    conda-forge
lxml                      3.8.0                    py36_0    conda-forge
markupsafe                1.0                      py36_0    conda-forge
matplotlib                2.0.2                    py36_2    conda-forge
mistune                   0.7.4                    py36_0    conda-forge
msgpack-python            0.4.8                    py36_0    conda-forge
nbconvert                 5.2.1                    py36_1    conda-forge
nbformat                  4.3.0                    py36_0    conda-forge
ncurses                   5.9                          10    conda-forge
netcdf4                   1.2.9                    py36_1    conda-forge
networkx                  1.11                     py36_0    conda-forge
notebook                  5.0.0                    py36_0    conda-forge
numexpr                   2.6.2               np113py36_0    conda-forge
numpy                     1.13.1          py36_blas_openblas_200  [blas_openblas]  conda-forge
olefile                   0.44                     py36_0    conda-forge
openblas                  0.2.19                        2    conda-forge
openssl                   1.0.2l                        0    conda-forge
owslib                    0.14.0                   py36_1    conda-forge
pandas                    0.20.3                   py36_1    conda-forge
pandoc                    1.19.2                        0    conda-forge
pandocfilters             1.4.1                    py36_0    conda-forge
param                     1.5.1                    py36_0    conda-forge
partd                     0.3.8                    py36_0    conda-forge
patsy                     0.4.1                    py36_0    conda-forge
pexpect                   4.2.1                    py36_0    conda-forge
pickleshare               0.7.4                    py36_0    conda-forge
pillow                    4.2.1                    py36_0    conda-forge
pip                       9.0.1                    py36_0    conda-forge
proj4                     4.9.3                         4    conda-forge
prompt_toolkit            1.0.15                   py36_0    conda-forge
psutil                    5.2.2                    py36_0    conda-forge
ptyprocess                0.5.2                    py36_0    conda-forge
pycparser                 2.18                     py36_0    conda-forge
pyepsg                    0.3.2                    py36_0    conda-forge
pygments                  2.2.0                    py36_0    conda-forge
pykdtree                  1.2.2                    py36_1    conda-forge
pyopenssl                 17.2.0                   py36_0    conda-forge
pyparsing                 2.2.0                    py36_0    conda-forge
pyproj                    1.9.5.1                  py36_0    conda-forge
pyqt                      5.6.0                    py36_4    conda-forge
pyresample                1.5.0               np113py36_0    conda-forge
pyshp                     1.2.12                     py_0    conda-forge
pysocks                   1.6.7                    py36_0    conda-forge
python                    3.6.2                         0    conda-forge
python-dateutil           2.6.1                    py36_0    conda-forge
pytz                      2017.2                   py36_0    conda-forge
pywavelets                0.5.2               np113py36_0    conda-forge
pyyaml                    3.12                     py36_1    conda-forge
pyzmq                     16.0.2                   py36_2    conda-forge
qt                        5.6.2                h9e3eb04_4    conda-forge
qtconsole                 4.3.1                    py36_0    conda-forge
readline                  6.2                           0    conda-forge
requests                  2.18.4                   py36_1    conda-forge
rise                      5.0.0                    py36_0    damianavila82
scikit-image              0.13.0                   py36_1    conda-forge
scikit-learn              0.19.0          py36_blas_openblas_201  [blas_openblas]  conda-forge
scipy                     0.19.1          py36_blas_openblas_202  [blas_openblas]  conda-forge
seaborn                   0.8.1                    py36_0    conda-forge
setuptools                36.3.0                   py36_0    conda-forge
shapely                   1.6.1                    py36_0    conda-forge
simplegeneric             0.8.1                    py36_0    conda-forge
sip                       4.18                     py36_1    conda-forge
six                       1.10.0                   py36_1    conda-forge
sortedcontainers          1.5.7                    py36_0    conda-forge
sqlite                    3.13.0                        1    conda-forge
statsmodels               0.8.0               np113py36_0    conda-forge
tblib                     1.3.2                    py36_0    conda-forge
terminado                 0.6                      py36_0    conda-forge
testpath                  0.3.1                    py36_0    conda-forge
tk                        8.5.19                        2    conda-forge
toolz                     0.8.2                    py36_0    conda-forge
tornado                   4.5.1                    py36_0    conda-forge
tqdm                      4.15.0                   py36_0    conda-forge
traitlets                 4.3.2                    py36_0    conda-forge
urllib3                   1.22                     py36_0    conda-forge
wcwidth                   0.1.7                    py36_0    conda-forge
webencodings              0.5                      py36_0    conda-forge
wheel                     0.29.0                   py36_0    conda-forge
widgetsnbextension        3.0.2                    py36_0    conda-forge
xarray                    0.9.6                    py36_0    conda-forge
xz                        5.2.3                         0    conda-forge
yaml                      0.1.6                         0    conda-forge
zeromq                    4.2.1                         1    conda-forge
zict                      0.1.2                    py36_0    conda-forge
zlib                      1.2.11                        0    conda-forge

change detection - dynamic choropleth using slider

I am struggling to construct dynamic choropleth maps, that correspond to different time stamps, and which are controllable by a slider. An example could be to visualize the change within a particular region from one poll to another using the slider.

I am thankful for any advise, especially with respect to an implementation using the Bokeh backend.

Error when specifying cartopy projection settings

When projection settings are passed to cartopy inline with the geoviews settings shebang, multi-parameter setting specifications will fail to work correctly.

For instance, here's a minimum working example:

import holoviews as hv
import geoviews as gv
import geoviews.feature as gf
from cartopy import crs
hv.notebook_extension()
g = crs.Orthographic(central_longitude=-98, central_latitude=39)

%%opts Overlay [fig_size=250 projection=g]
gf.land * gf.ocean

Here's a minimum non-working example:

import holoviews as hv
import geoviews as gv
import geoviews.feature as gf
from cartopy import crs
hv.notebook_extension()

%%opts Overlay [fig_size=250 projection=crs.Orthographic(central_longitude=-98, central_latitude=39)]
gf.land * gf.ocean

The latter will raise a Warning that this combination of parameters has been ignored, and the resultant map will be centered on the default axis (0,0) instead of the desired one, (-98, 39).

Disabling sliders for exported DynamicMaps

It's great that a DynamicMap will export to HTML with the currently visible data and with sliders that show that more data is available. However, because the sliders don't actually work in the exported copy (e.g. the last few cells of http://geo.holoviews.org/Iris_Datasets_II.html), it's very confusing to users, who are likely to think that the software is broken or buggy. We should either gray out the sliders, or at least make them not draggable, so that it is clear that the exported image is just an example and does not provide the full power of the Python version.

Alternatively, maybe it would be good for a user to be able to specify some default spacing on the dimensions, to be able to export the DynamicMap as a partially usable HoloMap?

Python 3.6 installation issues related to geoviews, holoviews, datashader stack

I attempted to make a Python 3.6 environment inclusive of datashader, holoviews, geoviews, and related dependencies. Here are the commands I ran:

conda create --name ds36 python=3.6
source activate ds36
conda install -c ioam/label/dev holoviews
conda install datashader
cd $C/datashader
python setup.py develop
conda install -c ioam paramnb
conda install -c scitools/label/dev -c conda-forge iris cartopy
conda install xarray
conda install -c conda-forge -c ioam holoviews>=1.6.2 geoviews

On the last line of that sequence of commands, I got the following error:

UnsatisfiableError: The following specifications were found to be in conflict:
  - geoviews -> python 2.7*
  - python 3.6*
Use "conda info <package>" to see the dependencies for each package.

Here's the ds36 at the time of that final failure:

appnope                   0.1.0                    py36_0
biggus                    0.15.0                   py36_0    conda-forge
bleach                    1.5.0                    py36_0
bokeh                     0.12.4                   py36_0
cartopy                   0.15.0              np112py36_0    conda-forge
cf_units                  1.1.3                    py36_1    conda-forge
chest                     0.2.3                    py36_0
cloudpickle               0.2.2                    py36_0
curl                      7.52.1                        0    conda-forge
cycler                    0.10.0                   py36_0
dask                      0.14.0                   py36_0
datashader                0.4.0                    py36_0
datashape                 0.5.4                    py36_0
decorator                 4.0.11                   py36_0
entrypoints               0.2.2                    py36_1
expat                     2.1.0                         2    conda-forge
freetype                  2.7                           1    conda-forge
geos                      3.5.1                         1    conda-forge
hdf4                      4.2.12                        0    conda-forge
hdf5                      1.8.17                        9    conda-forge
heapdict                  1.0.0                    py36_1
holoviews                 1.7dev6                  py36_0    ioam/label/dev
html5lib                  0.999                    py36_0
icu                       54.1                          0
ipykernel                 4.5.2                    py36_0
ipython                   5.3.0                    py36_0
ipython_genutils          0.1.0                    py36_0
ipywidgets                5.2.2                    py36_1
iris                      1.12.0                   py36_1    conda-forge
jbig                      2.1                           0
jinja2                    2.9.5                    py36_0
jpeg                      9b                            0
jsonschema                2.5.1                    py36_0
jupyter                   1.0.0                    py36_3
jupyter_client            5.0.0                    py36_0
jupyter_console           5.1.0                    py36_0
jupyter_core              4.3.0                    py36_0
libgfortran               3.0.0                         0    conda-forge
libiconv                  1.14                          4    conda-forge
libmo_unpack              3.0                           1    conda-forge
libnetcdf                 4.4.1.1                       2    conda-forge
libpng                    1.6.28                        0    conda-forge
libtiff                   4.0.6                         3
libxml2                   2.9.4                         0
libxslt                   1.1.29                        3    conda-forge
llvmlite                  0.16.0                   py36_0
locket                    0.2.0                    py36_1
lxml                      3.7.2                    py36_1    conda-forge
markupsafe                0.23                     py36_2
matplotlib                1.5.3               np112py36_7    conda-forge
mistune                   0.7.3                    py36_1
mkl                       2017.0.1                      0
mo_pack                   0.2.0               np112py36_0    conda-forge
multipledispatch          0.4.9                    py36_0
nbconvert                 5.1.1                    py36_0
nbformat                  4.3.0                    py36_0
nc_time_axis              1.0.1                    py36_0    conda-forge
netcdf4                   1.2.4               np112py36_3    conda-forge
networkx                  1.11                     py36_0
notebook                  4.3.1                    py36_0
numba                     0.31.0              np112py36_0
numpy                     1.12.0                   py36_0
odo                       0.5.0                    py36_1
olefile                   0.44                     py36_0
openssl                   1.0.2k                        0
owslib                    0.14.0                   py36_0    conda-forge
pandas                    0.19.2              np112py36_1
pandocfilters             1.4.1                    py36_0
param                     1.5.0                    py36_0    ioam
paramnb                   2.0.1                    py36_0    ioam
partd                     0.3.7                    py36_0
path.py                   10.1                     py36_0
pexpect                   4.2.1                    py36_0
pickleshare               0.7.4                    py36_0
pillow                    4.0.0                    py36_2    conda-forge
pip                       9.0.1                    py36_1
proj4                     4.9.3                         2    conda-forge
prompt_toolkit            1.0.9                    py36_0
ptyprocess                0.5.1                    py36_0
pyepsg                    0.3.1                    py36_0    conda-forge
pygments                  2.2.0                    py36_0
pyke                      1.1.1                    py36_0    conda-forge
pyparsing                 2.1.4                    py36_0
pyproj                    1.9.5.1                  py36_0    conda-forge
pyqt                      5.6.0                    py36_2
pyshp                     1.2.10                   py36_0    conda-forge
python                    3.6.0                         0
python-dateutil           2.6.0                    py36_0
pytz                      2016.10                  py36_0
pyyaml                    3.12                     py36_0
pyzmq                     16.0.2                   py36_0
qt                        5.6.2                         0
qtconsole                 4.2.1                    py36_1
readline                  6.2                           2
requests                  2.13.0                   py36_0
scipy                     0.18.1              np112py36_1
setuptools                27.2.0                   py36_0
shapely                   1.5.17              np112py36_2    conda-forge
simplegeneric             0.8.1                    py36_1
sip                       4.18                     py36_0
six                       1.10.0                   py36_0
sqlite                    3.13.0                        0
terminado                 0.6                      py36_0
testpath                  0.3                      py36_0
tk                        8.5.18                        0
toolz                     0.8.2                    py36_0
tornado                   4.4.2                    py36_0
traitlets                 4.3.2                    py36_0
udunits2                  2.2.23                        0    conda-forge
wcwidth                   0.1.7                    py36_0
wheel                     0.29.0                   py36_0
widgetsnbextension        1.2.6                    py36_0
xarray                    0.9.1                    py36_0
xz                        5.2.2                         1
yaml                      0.1.6                         0
zlib                      1.2.8                         3

I ran a similar sequence of commands for Python 2.7, 3.4, and 3.5 and the commands ran okay (I'm still now checking in those other Pythons envs if those envs actually work).

Units for transformed coordinates

In the Iris_Datasets_I tutorial, there's a cell that claims it's showing coordinates in degrees, but clearly they are no longer in degrees:

image

Fixing this would presumably require keeping track of units properly and converting them across projections. For now, perhaps just suppress the units?

Geoviews output

I have a choropleth map with hover text that I was able to create using Geoviews. Great job, by the way! I don't think I could have made the plot as I envisioned without your software!

Right now, I process the data and render the plot in a Jupyter notebook. I do not think that my issue represents a bug in the software, but I've been searching, trying suggestions I find, waiting (since GeoViews is quite new), and searching again for well over a month now, and I thought I would give this medium a try:

I want to take the plot I've made and save it as stand alone HTML (without Python code). Further, I want it to display in Internet Explorer. It currently displays fine in Chrome, but IE gives a blank page (see attached).

Thanks for any pointers you can give!

Untitled1.zip

Assume data in lon,lat by default?

Currently, GeoViews assumes no coordinate transformation for its elements, making most (all?) of them act like the corresponding HoloViews element. I.e., if the output is in the Web Mercator projection, then the input data is also assumed to be in Web Mercator units.

This convention makes sense, but it doesn't seem to me to be the most useful default, and it doesn't seem to fit with the idea of GeoViews as a separate package from HoloViews. The major reason to use a GeoViews Path or Points object instead of the corresponding HoloViews object is precisely so that coordinates will be transformed, so shouldn't we decouple the input and output coordinate systems by default? Right now, unless one specifies the crs for every element, there's no way to change the output transformation, so those two are tightly coupled by default.

To avoid that problem, users currently have to specify crs=crs.PlateCarree() everywhere, for what is surely the typical case of having data specified in longitude, latitude coordinates.

I propose that we add a parameter declaring a default coordinate system for all GeoViews objects, and that this parameter be crs.PlateCarree() by default. This would be a breaking change, but only for behavior that doesn't seem very useful now anyway, i.e. default values that are tied to the output projection.

Lat/lon labels

It'd be great to have the labels on maps x and y axis show latitude/longitude (that is, in degrees), instead of (when using Bokeh, for example), in the meters of the underlying Mercator projection.

So instead of something labeled like the following, with meters for units:
screen shot 2016-09-11 at 8 09 34 am

I would want something labeled like the following, with degrees labeled, and the ability to make it look nicely formatted (not that these are in the same area of the world):
screen shot 2016-09-11 at 8 09 14 am

I made the second plot with cartopy and used some of their extra stuff with matplotlib to get the labels formatted nicely.

In my experience, this would be following convention set up by, for example, the basemap package.

Thanks!

Easily resampling choropleths

When GeoViews is used with datashader, it can make sense to convert a choropleth into an approximation of the underlying population-based data, as was done for the census dataset here:

image

In that example, the census data was only available at the block level, but by randomly choosing a location for each datapoint from the population count per block, the plot becomes very concrete, conveniently conveying both population counts across the surface and category information in a way that is easily interpretable when zooming in.

So, it would be nice if there were a convenient way to spatially resample shapefile-based data like:

image

to create a synthetic population plot like the above. For this example, there would need to be a way to choose between two categories (vote for and against) or three categories (for, against, did not vote).

Changing levels in a dynamic map

One of the user stories involves modifying the contour levels with a slider. This is a plot option on FilledContours although it is then translated into kwargs for iris.plot.contourf.

Changing the options of the elements within a DynamicMap doesn't reflect this change. Although this is a known limitation for many elements due to the way artists are initialized and updated, I was wondering if it was possible to get this working given that every frame is redrawn by the iris.plot.contourf calls.

Use bokeh GeoJSON support

Currently the Shape element, which is useful to render shapely geometries directly is being converted into lists of paths or polygons before being passed to bokeh plotting calls. However bokeh has a GeoJSONDataSource, which could be used instead. As I understand it shapely geometries can emit valid GeoJSON via the .mapping attribute, which I could then pass to bokeh's GeoJSONDataSource. I just have to check that the holoviews code can handle updating these data sources correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.