0

I have the following line:

(dataset.redim(WD_spec001=dict(range=(0, 30000))).to(gv.Image, ['longitude', 'latitude'], ['time']) * gf.coastline())

but really, the range and color scale should be logarithmic. In matplotlib I've been accomplishing by generating a 'clevs' array using the following:

def _log_clevs(dat_min, dat_max):
    """
    create logorithmic color scale

    """

    if dat_max > 0:
        dmx = int(np.round(np.log10(dat_max))) + 1
    else:
        # dat_max not positive
        dmx = 1

    if dat_min > 0:
        dmn = int(np.round(np.log10(dat_min)))
    elif dat_min == 0. or np.isnan(dat_min):
        # hack
        dmn = dmx - 3


    # create equally spaced range
    if dmx == dmn:
        dmx = dmn + 1
    clevs = np.logspace(dmn, dmx, 100)

    return clevs

Is there a way to accomplish this with holoviews/geoviews?

John
  • 1,263
  • 2
  • 15
  • 26

1 Answers1

1

The Image Element in HoloViews and GeoViews have a plot option called logz, which should let you specify a logarithmic colormap. Try this in the notebook:

%%opts Image [logz=True]
(dataset.redim(WD_spec001=dict(range=(0, 30000))).to(gv.Image, 
 ['longitude', 'latitude'], ['time']) * gf.coastline())
philippjfr
  • 3,997
  • 14
  • 15