holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
577 stars 75 forks source link

VectorField only plots in certain projections #359

Open TeriForey opened 4 years ago

TeriForey commented 4 years ago

I'm trying to plot vectors around the North pole and when I try to use the NorthPolarStereo projection, nothing is plotted. It does plot when I use a different projection like PlateCarree or Miller.

I'm using the following versions:

bokeh                     1.3.4                    py37_0    conda-forge
cartopy                   0.17.0          py37h929c6f0_1004    conda-forge
geoviews                  1.6.3                      py_0    pyviz
geoviews-core             1.6.3                      py_0    pyviz
holoviews                 1.12.5                     py_0    pyviz
python                    3.7.3                h93065d6_1    conda-forge

Example code:

import geoviews as gv
from geoviews import opts
from cartopy import crs
import numpy as np
gv.extension('bokeh')

lon = np.array([306.1017, 317.0930, 315.7377, 316.2712, 318.3051])
lat = np.array([60.5000, 61.5000, 59.5000, 60.5000, 60.5000])
ang = np.array([0.2048, 0.7487, 3.8524, 3.8675, 0.8121])
mag = np.array([1.0000, 0.3271, 0.5395, 0.1323, 0.8271])

vec = gv.VectorField((lon, lat, ang, mag)).opts(opts.VectorField(
    magnitude='Magnitude', color='Magnitude', rescale_lengths=False, pivot='tip', padding=0.1))

vec.opts(projection=crs.PlateCarree())  # works
vec.opts(projection=crs.NorthPolarStereo())  # doesn't plot anything

Is this a bug or is there something that I'm doing which isn't right? All other elements that I'm plotting (Points, Paths etc) work fine on the NorthPolar projection.

Thank you

philippjfr commented 4 years ago

Probably down to this https://github.com/pyviz/geoviews/pull/296