Coordinate transformations

Motivation

In all fields of science we frequently encounter data that is represented in coordinates or coordinate systems that are not apt for certain operations or visualizations. In these cases we may thus need to compute new coordinates based on one or multiple existing coordinates. For simple cases this may just be done by hand. Consider:

[1]:
import scipp as sc

x = sc.linspace(dim='x', unit='m', start=1., stop=55., num=100)
da = sc.DataArray(data=x * x, coords={'x': x})
da.plot(figsize=(4, 3))

We may want to use \(x^2\) instead of \(x\) as a coordinate, to highlight the quadratic nature of our data:

[2]:
da2 = da.copy()
da2.coords['x_square'] = x * x
da2
[2]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (2.34 KB)
    • x: 100
    • x
      (x)
      float64
      m
      1.0, 1.55, ..., 54.45, 55.0
      Values:
      array([ 1. , 1.54545455, 2.09090909, 2.63636364, 3.18181818, 3.72727273, 4.27272727, 4.81818182, 5.36363636, 5.90909091, 6.45454545, 7. , 7.54545455, 8.09090909, 8.63636364, 9.18181818, 9.72727273, 10.27272727, 10.81818182, 11.36363636, 11.90909091, 12.45454545, 13. , 13.54545455, 14.09090909, 14.63636364, 15.18181818, 15.72727273, 16.27272727, 16.81818182, 17.36363636, 17.90909091, 18.45454545, 19. , 19.54545455, 20.09090909, 20.63636364, 21.18181818, 21.72727273, 22.27272727, 22.81818182, 23.36363636, 23.90909091, 24.45454545, 25. , 25.54545455, 26.09090909, 26.63636364, 27.18181818, 27.72727273, 28.27272727, 28.81818182, 29.36363636, 29.90909091, 30.45454545, 31. , 31.54545455, 32.09090909, 32.63636364, 33.18181818, 33.72727273, 34.27272727, 34.81818182, 35.36363636, 35.90909091, 36.45454545, 37. , 37.54545455, 38.09090909, 38.63636364, 39.18181818, 39.72727273, 40.27272727, 40.81818182, 41.36363636, 41.90909091, 42.45454545, 43. , 43.54545455, 44.09090909, 44.63636364, 45.18181818, 45.72727273, 46.27272727, 46.81818182, 47.36363636, 47.90909091, 48.45454545, 49. , 49.54545455, 50.09090909, 50.63636364, 51.18181818, 51.72727273, 52.27272727, 52.81818182, 53.36363636, 53.90909091, 54.45454545, 55. ])
    • x_square
      (x)
      float64
      m^2
      1.0, 2.39, ..., 2965.3, 3025.0
      Values:
      array([1.00000000e+00, 2.38842975e+00, 4.37190083e+00, 6.95041322e+00, 1.01239669e+01, 1.38925620e+01, 1.82561983e+01, 2.32148760e+01, 2.87685950e+01, 3.49173554e+01, 4.16611570e+01, 4.90000000e+01, 5.69338843e+01, 6.54628099e+01, 7.45867769e+01, 8.43057851e+01, 9.46198347e+01, 1.05528926e+02, 1.17033058e+02, 1.29132231e+02, 1.41826446e+02, 1.55115702e+02, 1.69000000e+02, 1.83479339e+02, 1.98553719e+02, 2.14223140e+02, 2.30487603e+02, 2.47347107e+02, 2.64801653e+02, 2.82851240e+02, 3.01495868e+02, 3.20735537e+02, 3.40570248e+02, 3.61000000e+02, 3.82024793e+02, 4.03644628e+02, 4.25859504e+02, 4.48669421e+02, 4.72074380e+02, 4.96074380e+02, 5.20669421e+02, 5.45859504e+02, 5.71644628e+02, 5.98024793e+02, 6.25000000e+02, 6.52570248e+02, 6.80735537e+02, 7.09495868e+02, 7.38851240e+02, 7.68801653e+02, 7.99347107e+02, 8.30487603e+02, 8.62223140e+02, 8.94553719e+02, 9.27479339e+02, 9.61000000e+02, 9.95115702e+02, 1.02982645e+03, 1.06513223e+03, 1.10103306e+03, 1.13752893e+03, 1.17461983e+03, 1.21230579e+03, 1.25058678e+03, 1.28946281e+03, 1.32893388e+03, 1.36900000e+03, 1.40966116e+03, 1.45091736e+03, 1.49276860e+03, 1.53521488e+03, 1.57825620e+03, 1.62189256e+03, 1.66612397e+03, 1.71095041e+03, 1.75637190e+03, 1.80238843e+03, 1.84900000e+03, 1.89620661e+03, 1.94400826e+03, 1.99240496e+03, 2.04139669e+03, 2.09098347e+03, 2.14116529e+03, 2.19194215e+03, 2.24331405e+03, 2.29528099e+03, 2.34784298e+03, 2.40100000e+03, 2.45475207e+03, 2.50909917e+03, 2.56404132e+03, 2.61957851e+03, 2.67571074e+03, 2.73243802e+03, 2.78976033e+03, 2.84767769e+03, 2.90619008e+03, 2.96529752e+03, 3.02500000e+03])
    • (x)
      float64
      m^2
      1.0, 2.39, ..., 2965.3, 3025.0
      Values:
      array([1.00000000e+00, 2.38842975e+00, 4.37190083e+00, 6.95041322e+00, 1.01239669e+01, 1.38925620e+01, 1.82561983e+01, 2.32148760e+01, 2.87685950e+01, 3.49173554e+01, 4.16611570e+01, 4.90000000e+01, 5.69338843e+01, 6.54628099e+01, 7.45867769e+01, 8.43057851e+01, 9.46198347e+01, 1.05528926e+02, 1.17033058e+02, 1.29132231e+02, 1.41826446e+02, 1.55115702e+02, 1.69000000e+02, 1.83479339e+02, 1.98553719e+02, 2.14223140e+02, 2.30487603e+02, 2.47347107e+02, 2.64801653e+02, 2.82851240e+02, 3.01495868e+02, 3.20735537e+02, 3.40570248e+02, 3.61000000e+02, 3.82024793e+02, 4.03644628e+02, 4.25859504e+02, 4.48669421e+02, 4.72074380e+02, 4.96074380e+02, 5.20669421e+02, 5.45859504e+02, 5.71644628e+02, 5.98024793e+02, 6.25000000e+02, 6.52570248e+02, 6.80735537e+02, 7.09495868e+02, 7.38851240e+02, 7.68801653e+02, 7.99347107e+02, 8.30487603e+02, 8.62223140e+02, 8.94553719e+02, 9.27479339e+02, 9.61000000e+02, 9.95115702e+02, 1.02982645e+03, 1.06513223e+03, 1.10103306e+03, 1.13752893e+03, 1.17461983e+03, 1.21230579e+03, 1.25058678e+03, 1.28946281e+03, 1.32893388e+03, 1.36900000e+03, 1.40966116e+03, 1.45091736e+03, 1.49276860e+03, 1.53521488e+03, 1.57825620e+03, 1.62189256e+03, 1.66612397e+03, 1.71095041e+03, 1.75637190e+03, 1.80238843e+03, 1.84900000e+03, 1.89620661e+03, 1.94400826e+03, 1.99240496e+03, 2.04139669e+03, 2.09098347e+03, 2.14116529e+03, 2.19194215e+03, 2.24331405e+03, 2.29528099e+03, 2.34784298e+03, 2.40100000e+03, 2.45475207e+03, 2.50909917e+03, 2.56404132e+03, 2.61957851e+03, 2.67571074e+03, 2.73243802e+03, 2.78976033e+03, 2.84767769e+03, 2.90619008e+03, 2.96529752e+03, 3.02500000e+03])

While adding a new coordinate may often be done with a single line of code, the above example highlights the first shortcoming of this approach: To actually visualize da using this new coordinate we must additionally rename the dimension:

[3]:
da2 = da2.rename_dims({'x': 'x_square'})
da2.plot(figsize=(4, 3))

Further complications are:

  • The original coordinate is preserved and may get in the way in subsequent operations.

  • Event-coordinates of binned data are not handled.

  • Multi-step conversions with multiple inputs and multiple outputs may be required in practice.

To accommodate these recurring yet highly application-specific needs, scipp provides a generic mechanism for transforming coordinates. This is described and exemplified in the following.

transform_coords

Overview

sc.transform_coords (also available as method of data arrays and datasets) is a tool for transforming one or more input coordinates into one or more output coordinates. It automatically handles:

  • Renaming of dimensions, if dimension-coordinates are transformed.

  • Change of coordinates to attributes to avoid interference of coordinates consumed by the transformation in follow-up operations.

  • Conversion of event-coordinates of binned data, if present.

Basic example

We start by revisiting the example given in Motivation. The building blocks transform_coords operates on are functions with named parameters. The parameter names define the names of the input coordinates to consume. Let us define x_square, which will consume x:

[4]:
def x_square(x):
    return x * x

Next, we create a dict, mapping from an output coord name to a function that can create this coordinate. The sc.show_graph helper is a convenient tool for visualizing the coordinate transformation defined by such as mapping:

[5]:
graph = {'x^2': x_square}
sc.show_graph(graph)
[5]:
../_images/user-guide_coordinate-transformations_9_0.svg

Here, the x coordinate can be consumed by the x_square function, creating the x^2 coordinate. Note that the function name and coordinate are unrelated. Next, we can call transform_coords. Apart from the graph, we also pass a list of desired output coordinates, here simply ['x^2']. transform_coords returns a new (shallow-copied) data array with added coordinates:

[6]:
transformed = da.transform_coords(['x^2'], graph=graph)
transformed
[6]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (2.34 KB)
    • x^2: 100
    • x^2
      (x^2)
      float64
      m^2
      1.0, 2.39, ..., 2965.3, 3025.0
      Values:
      array([1.00000000e+00, 2.38842975e+00, 4.37190083e+00, 6.95041322e+00, 1.01239669e+01, 1.38925620e+01, 1.82561983e+01, 2.32148760e+01, 2.87685950e+01, 3.49173554e+01, 4.16611570e+01, 4.90000000e+01, 5.69338843e+01, 6.54628099e+01, 7.45867769e+01, 8.43057851e+01, 9.46198347e+01, 1.05528926e+02, 1.17033058e+02, 1.29132231e+02, 1.41826446e+02, 1.55115702e+02, 1.69000000e+02, 1.83479339e+02, 1.98553719e+02, 2.14223140e+02, 2.30487603e+02, 2.47347107e+02, 2.64801653e+02, 2.82851240e+02, 3.01495868e+02, 3.20735537e+02, 3.40570248e+02, 3.61000000e+02, 3.82024793e+02, 4.03644628e+02, 4.25859504e+02, 4.48669421e+02, 4.72074380e+02, 4.96074380e+02, 5.20669421e+02, 5.45859504e+02, 5.71644628e+02, 5.98024793e+02, 6.25000000e+02, 6.52570248e+02, 6.80735537e+02, 7.09495868e+02, 7.38851240e+02, 7.68801653e+02, 7.99347107e+02, 8.30487603e+02, 8.62223140e+02, 8.94553719e+02, 9.27479339e+02, 9.61000000e+02, 9.95115702e+02, 1.02982645e+03, 1.06513223e+03, 1.10103306e+03, 1.13752893e+03, 1.17461983e+03, 1.21230579e+03, 1.25058678e+03, 1.28946281e+03, 1.32893388e+03, 1.36900000e+03, 1.40966116e+03, 1.45091736e+03, 1.49276860e+03, 1.53521488e+03, 1.57825620e+03, 1.62189256e+03, 1.66612397e+03, 1.71095041e+03, 1.75637190e+03, 1.80238843e+03, 1.84900000e+03, 1.89620661e+03, 1.94400826e+03, 1.99240496e+03, 2.04139669e+03, 2.09098347e+03, 2.14116529e+03, 2.19194215e+03, 2.24331405e+03, 2.29528099e+03, 2.34784298e+03, 2.40100000e+03, 2.45475207e+03, 2.50909917e+03, 2.56404132e+03, 2.61957851e+03, 2.67571074e+03, 2.73243802e+03, 2.78976033e+03, 2.84767769e+03, 2.90619008e+03, 2.96529752e+03, 3.02500000e+03])
    • (x^2)
      float64
      m^2
      1.0, 2.39, ..., 2965.3, 3025.0
      Values:
      array([1.00000000e+00, 2.38842975e+00, 4.37190083e+00, 6.95041322e+00, 1.01239669e+01, 1.38925620e+01, 1.82561983e+01, 2.32148760e+01, 2.87685950e+01, 3.49173554e+01, 4.16611570e+01, 4.90000000e+01, 5.69338843e+01, 6.54628099e+01, 7.45867769e+01, 8.43057851e+01, 9.46198347e+01, 1.05528926e+02, 1.17033058e+02, 1.29132231e+02, 1.41826446e+02, 1.55115702e+02, 1.69000000e+02, 1.83479339e+02, 1.98553719e+02, 2.14223140e+02, 2.30487603e+02, 2.47347107e+02, 2.64801653e+02, 2.82851240e+02, 3.01495868e+02, 3.20735537e+02, 3.40570248e+02, 3.61000000e+02, 3.82024793e+02, 4.03644628e+02, 4.25859504e+02, 4.48669421e+02, 4.72074380e+02, 4.96074380e+02, 5.20669421e+02, 5.45859504e+02, 5.71644628e+02, 5.98024793e+02, 6.25000000e+02, 6.52570248e+02, 6.80735537e+02, 7.09495868e+02, 7.38851240e+02, 7.68801653e+02, 7.99347107e+02, 8.30487603e+02, 8.62223140e+02, 8.94553719e+02, 9.27479339e+02, 9.61000000e+02, 9.95115702e+02, 1.02982645e+03, 1.06513223e+03, 1.10103306e+03, 1.13752893e+03, 1.17461983e+03, 1.21230579e+03, 1.25058678e+03, 1.28946281e+03, 1.32893388e+03, 1.36900000e+03, 1.40966116e+03, 1.45091736e+03, 1.49276860e+03, 1.53521488e+03, 1.57825620e+03, 1.62189256e+03, 1.66612397e+03, 1.71095041e+03, 1.75637190e+03, 1.80238843e+03, 1.84900000e+03, 1.89620661e+03, 1.94400826e+03, 1.99240496e+03, 2.04139669e+03, 2.09098347e+03, 2.14116529e+03, 2.19194215e+03, 2.24331405e+03, 2.29528099e+03, 2.34784298e+03, 2.40100000e+03, 2.45475207e+03, 2.50909917e+03, 2.56404132e+03, 2.61957851e+03, 2.67571074e+03, 2.73243802e+03, 2.78976033e+03, 2.84767769e+03, 2.90619008e+03, 2.96529752e+03, 3.02500000e+03])
    • x
      (x^2)
      float64
      m
      1.0, 1.55, ..., 54.45, 55.0
      Values:
      array([ 1. , 1.54545455, 2.09090909, 2.63636364, 3.18181818, 3.72727273, 4.27272727, 4.81818182, 5.36363636, 5.90909091, 6.45454545, 7. , 7.54545455, 8.09090909, 8.63636364, 9.18181818, 9.72727273, 10.27272727, 10.81818182, 11.36363636, 11.90909091, 12.45454545, 13. , 13.54545455, 14.09090909, 14.63636364, 15.18181818, 15.72727273, 16.27272727, 16.81818182, 17.36363636, 17.90909091, 18.45454545, 19. , 19.54545455, 20.09090909, 20.63636364, 21.18181818, 21.72727273, 22.27272727, 22.81818182, 23.36363636, 23.90909091, 24.45454545, 25. , 25.54545455, 26.09090909, 26.63636364, 27.18181818, 27.72727273, 28.27272727, 28.81818182, 29.36363636, 29.90909091, 30.45454545, 31. , 31.54545455, 32.09090909, 32.63636364, 33.18181818, 33.72727273, 34.27272727, 34.81818182, 35.36363636, 35.90909091, 36.45454545, 37. , 37.54545455, 38.09090909, 38.63636364, 39.18181818, 39.72727273, 40.27272727, 40.81818182, 41.36363636, 41.90909091, 42.45454545, 43. , 43.54545455, 44.09090909, 44.63636364, 45.18181818, 45.72727273, 46.27272727, 46.81818182, 47.36363636, 47.90909091, 48.45454545, 49. , 49.54545455, 50.09090909, 50.63636364, 51.18181818, 51.72727273, 52.27272727, 52.81818182, 53.36363636, 53.90909091, 54.45454545, 55. ])

Note how x is now an attribute, i.e., operations will not use it for alignment anymore. This is important since it will allow for operations combining transformed with other data that may have matching x^2 but not x.

Example: Multi-step transform splitting and combining input coords

Introduction

Let us consider a more complex example. Imagine we have sensors around the globe, counting lightning strikes. For each sensor get have data recorded at a certain UTC, and the sensor location. We may be interested in variation of lightning strike frequency with time of day, as well as latitude. To obtain this, we must:

  1. Extract latitude and longitude information from the sensor locations.

  2. Compute the local datetime from the datetime and a “timezone” offset from the longitude.

  3. Extract the time from the local datetime.

For this purpose, we may define functions that look as follows. We suggest ignoring the implementation details of these functions, since they are approximations and irrelevant for this example:

[7]:
def lat_long(location):
    x = location.fields.x
    y = location.fields.y
    z = location.fields.z
    theta = sc.to_unit(sc.atan2(y=sc.sqrt(x * x + y * y), x=z),
                       'deg',
                       copy=False)
    phi = sc.to_unit(sc.atan2(y=y, x=x), 'deg', copy=False)
    return {'latitude': 90.0 * sc.Unit('deg') - theta, 'longitude': phi}


def local_datetime(datetime, longitude):
    long = sc.to_unit(longitude, unit='deg', copy=False)
    angular_velocity = (360.0 * sc.Unit('deg')) / (24.0 * sc.Unit('hour'))
    offset = (
        long /
        angular_velocity).astype('int64') + 12 * sc.Unit('hour')
    return sc.to_unit(offset, datetime.unit) + datetime


def time(local_datetime):
    seconds_per_day = sc.scalar(24 * 60 * 60, unit='s/D')
    start_day = sc.scalar(start.value.astype('datetime64[D]'))
    start_day_in_seconds = sc.scalar(start_day.values.astype('datetime64[s]'))
    offset = local_datetime - start_day_in_seconds
    time = (offset % seconds_per_day).astype('float64')
    return time

Defining a transformation graph

Based on these functions we may then create a mapping between coordinate names and functions. The visualization of the graph gives a handy summary of the desired conversion outlined above:

[8]:
graph = {
    (
        'longitude',
        'latitude',
    ): lat_long,
    'local_time': time,
    'local_datetime': local_datetime
}
sc.show_graph(graph, size='6')
[8]:
../_images/user-guide_coordinate-transformations_15_0.svg

Sample data

Next, let us look at the data we are working with. Here we simply create some fake data, the details of the following code cell are irrelevant and should also be ignored:

[9]:
import numpy as np

hour_steps = sc.arange(dim='datetime',
                       dtype='int64',
                       unit='s',
                       start=0,
                       stop=3 * 24 * 60 * 60,
                       step=60 * 60)
start = sc.scalar(np.datetime64('2021-06-01T17:00:00'))
datetime = start + hour_steps
nsite = 1000
ntime = len(datetime)
# Note that these points are NOT uniformly distributed on a sphere, this is NOT a good way to generate such points
location = sc.vectors(dims=['location'], values=np.random.rand(
    nsite, 3)) - sc.vector(value=[.5, .5, .5])
location *= 6371 * sc.Unit('km') / sc.norm(location)
da = sc.DataArray(data=sc.array(dims=['location', 'datetime'],
                                values=np.random.rand(nsite, ntime)),
                  coords={
                      'location': location,
                      'datetime': datetime
                  })
da += 2. * (location.fields.z > 0. * sc.Unit('km')).astype(
    'float64')  # more lightning strikes in northern hemisphere
phi0 = sc.atan2(y=location.fields.y, x=location.fields.x) - sc.to_unit(
    90.0 * sc.Unit('deg'), 'rad')
sin = sc.sin(
    phi0 +
    sc.linspace(dim='datetime', unit='rad', start=0, stop=6 * np.pi, num=ntime))
da += 2 * (sin + 1)  # more lightning strikes later in the day
da.unit = 'counts'

Our input data looks as follows, a 2-D data array with dimensions datetime and location, and corresponding coordinates:

[10]:
da
[10]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (586.50 KB)
    • location: 1000
    • datetime: 72
    • datetime
      (datetime)
      datetime64
      s
      2021-06-01T17:00:00, 2021-06-01T18:00:00, ..., 2021-06-04T15:00:00, 2021-06-04T16:00:00
      Values:
      array(['2021-06-01T17:00:00', '2021-06-01T18:00:00', '2021-06-01T19:00:00', '2021-06-01T20:00:00', '2021-06-01T21:00:00', '2021-06-01T22:00:00', '2021-06-01T23:00:00', '2021-06-02T00:00:00', '2021-06-02T01:00:00', '2021-06-02T02:00:00', '2021-06-02T03:00:00', '2021-06-02T04:00:00', '2021-06-02T05:00:00', '2021-06-02T06:00:00', '2021-06-02T07:00:00', '2021-06-02T08:00:00', '2021-06-02T09:00:00', '2021-06-02T10:00:00', '2021-06-02T11:00:00', '2021-06-02T12:00:00', '2021-06-02T13:00:00', '2021-06-02T14:00:00', '2021-06-02T15:00:00', '2021-06-02T16:00:00', '2021-06-02T17:00:00', '2021-06-02T18:00:00', '2021-06-02T19:00:00', '2021-06-02T20:00:00', '2021-06-02T21:00:00', '2021-06-02T22:00:00', '2021-06-02T23:00:00', '2021-06-03T00:00:00', '2021-06-03T01:00:00', '2021-06-03T02:00:00', '2021-06-03T03:00:00', '2021-06-03T04:00:00', '2021-06-03T05:00:00', '2021-06-03T06:00:00', '2021-06-03T07:00:00', '2021-06-03T08:00:00', '2021-06-03T09:00:00', '2021-06-03T10:00:00', '2021-06-03T11:00:00', '2021-06-03T12:00:00', '2021-06-03T13:00:00', '2021-06-03T14:00:00', '2021-06-03T15:00:00', '2021-06-03T16:00:00', '2021-06-03T17:00:00', '2021-06-03T18:00:00', '2021-06-03T19:00:00', '2021-06-03T20:00:00', '2021-06-03T21:00:00', '2021-06-03T22:00:00', '2021-06-03T23:00:00', '2021-06-04T00:00:00', '2021-06-04T01:00:00', '2021-06-04T02:00:00', '2021-06-04T03:00:00', '2021-06-04T04:00:00', '2021-06-04T05:00:00', '2021-06-04T06:00:00', '2021-06-04T07:00:00', '2021-06-04T08:00:00', '2021-06-04T09:00:00', '2021-06-04T10:00:00', '2021-06-04T11:00:00', '2021-06-04T12:00:00', '2021-06-04T13:00:00', '2021-06-04T14:00:00', '2021-06-04T15:00:00', '2021-06-04T16:00:00'], dtype='datetime64[s]')
    • location
      (location)
      vector_3_float64
      km
      [ 571.77868666 -4281.40448273 4683.1918377 ], [-1666.0407522 -3598.38919433 4986.53631473], ..., [-1866.92481414 3228.67850162 -5165.25583795], [ 2800.88390772 -3767.94184384 -4306.65817043]
      Values:
      array([[ 571.77868666, -4281.40448273, 4683.1918377 ], [-1666.0407522 , -3598.38919433, 4986.53631473], [ 3669.6763539 , -1548.02332804, 4972.59894154], ..., [-3142.51443669, -4067.66649023, 3764.08466157], [-1866.92481414, 3228.67850162, -5165.25583795], [ 2800.88390772, -3767.94184384, -4306.65817043]])
    • (location, datetime)
      float64
      counts
      4.43, 4.11, ..., 1.47, 1.23
      Values:
      array([[4.42867341, 4.111534 , 3.37538692, ..., 4.79696001, 5.20675205, 3.92567206], [5.34583922, 4.60467457, 4.58817595, ..., 5.93446155, 5.40293595, 5.37248551], [2.44323171, 2.65079757, 2.05276799, ..., 3.62634687, 2.75139533, 3.07662151], ..., [6.19607892, 5.51764126, 4.51106706, ..., 6.67223947, 5.69698029, 5.44387367], [3.48840011, 4.25009532, 3.90619928, ..., 2.54831688, 2.74286982, 3.25032765], [1.10164453, 1.16961296, 1.01363951, ..., 2.41102182, 1.46876642, 1.22548782]])

A 3-D scatter plot may be used to visualize this. When dragging the datetime slider we can observe how the lightning counts shifts around the globe with the time of the day (the fake data covers a period of 3 days). Note that the slider is only functional when running the notebook and is not functional in the online documentation page:

[11]:
da.plot(projection='3d', positions='location')

Performing a transformation

With this setup, the actual coordinate transformation is now very simple:

[12]:
transformed = da.transform_coords(['latitude', 'local_time'], graph=graph)

The result is:

[13]:
transformed
[13]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (1.69 MB)
    • location: 1000
    • local_time: 72
    • latitude
      (location)
      float64
      deg
      47.31, 51.51, ..., -54.17, -42.53
      Values:
      array([ 4.73139387e+01, 5.15077982e+01, 5.13068588e+01, -3.08925643e+01, 3.76257195e+01, -2.99682536e+01, 2.06700143e+01, -5.34911838e+01, 4.46175914e+00, 3.40598958e+01, 7.42614877e+00, -3.70590398e+01, -5.82878369e+01, -2.51429866e+01, -5.13215257e+01, 3.60143229e+01, -2.17653112e+01, -3.82707083e+01, -5.53834877e+01, -5.54990860e+01, -4.23181238e+01, 3.15761645e+01, -4.20953722e+01, 3.05456783e+01, 5.32607584e+01, -3.64532255e+01, -2.28413337e+01, -1.91233732e+01, -2.82097370e+01, 4.50554226e+01, -4.50638544e+01, -1.29825607e+01, 2.18422872e+01, -2.65026053e+01, 1.82266604e+01, 1.19573620e+01, 6.51056110e+01, 3.97854661e+01, -8.00935619e+00, -5.46600818e+01, 8.35122645e+00, 1.60747181e+01, 4.23616802e+01, 2.90915499e+01, -3.19494376e+01, -3.67013975e+01, 1.09858780e+01, 2.87488694e+01, 2.94771115e+00, 3.21041258e+01, -5.49598705e+01, -3.70199850e+01, -5.31721015e+01, -3.45432919e+01, -9.27467736e+00, -3.82247376e+01, 2.58892041e+01, 4.69911233e+00, 2.62185278e+01, -4.29587942e+01, -2.01746337e+01, 3.48901909e+01, -7.37868010e-01, -2.73600214e+01, -5.17764516e+01, -3.11482746e+01, 3.23590103e+01, 6.94272988e+01, -1.86346216e+01, -4.59093545e+01, -7.16110481e+01, -5.07129005e+00, -2.96755909e+01, 4.11624389e+01, 7.14537628e+01, 6.86809622e+01, 4.55169777e+01, 7.31802906e+01, -4.07292224e+01, 3.63352258e+01, 2.79521258e+01, 3.21789180e+01, -4.40075830e+01, -2.15123179e+01, 1.21031326e+01, 7.04670050e+01, 9.54140896e-01, 4.01157807e+01, 4.87484657e+01, -1.52987663e+01, 4.76102095e+01, 3.38088693e+01, -1.70208631e+01, -2.12254727e+01, 7.70572138e+01, -9.93908891e+00, -8.01993819e+01, -2.61402225e+01, -6.46604880e+01, 4.05206348e+01, -5.34040542e+01, 5.38247089e+01, 4.12439993e+01, 9.45453325e+00, 3.07716199e+00, 6.13025455e+01, -2.63174172e+01, -5.59698986e+01, 4.51913464e+01, 2.08395727e+01, -6.06716597e+01, 2.52814712e+01, 4.46227580e+01, 5.66808889e+01, 4.74272676e+01, 4.16604378e+01, -5.85436792e+00, 1.80217182e+01, -5.32256149e+01, -1.70315637e+01, 7.53710861e+00, 8.21016393e+00, 3.73667280e+01, 2.66114357e+00, -1.76170875e+00, 3.06967596e+01, -5.58197463e+00, -1.40876579e+01, 5.49800101e+01, -5.30617742e+01, -6.70067598e+01, 4.36042526e+01, 1.92093283e+01, -4.35374841e+01, -3.87271029e+01, 3.69531113e+01, -6.57087619e+01, 6.74796789e+01, 6.52975414e+01, -1.77975758e+01, -2.60988090e+01, 2.81940706e+01, -8.49757427e+00, -2.58018901e+01, -7.04790396e+00, 1.59149936e+01, -6.11889442e-01, 3.86989977e+01, -1.34680349e+01, 4.37811282e+01, -8.68217739e+00, -3.74274643e+01, -4.76273623e+01, -3.36408044e+01, 2.86423385e+01, 4.19766025e+01, 4.72575553e+01, 1.81447369e+01, -4.27750684e+01, -3.60572436e+01, 2.21701562e+00, 4.58300298e+01, 5.25167766e+01, 5.88359199e+01, 4.17174702e+01, -2.59039748e+01, -2.54354986e+01, -1.88254218e+01, 1.01894253e+01, 4.20256632e+01, 5.65863284e+00, -5.24898918e+01, -3.64981388e+01, -3.30246749e+01, 2.24363503e+01, 4.35659954e+01, -2.45086164e+01, -1.67699712e+01, -1.68792496e+00, -6.49893956e+01, -3.61579506e+01, 7.49561004e+01, -1.52535412e+01, 4.00154277e+01, 3.26146516e+01, 1.71472574e+01, 6.43612786e+01, -1.50367076e+01, 4.24068546e+01, 3.91814880e+01, -6.18095944e+00, 4.72693855e+01, 6.86811669e+01, -5.97360453e+01, 4.48593027e+01, -7.83178756e+01, -4.39648876e+01, 2.02339020e+00, 2.94561047e+01, -1.85103821e+01, -2.77562367e+01, 4.49394343e+01, -3.45015357e+01, -6.53028057e+01, -2.30479740e+01, 6.22088011e+01, -8.64951102e+00, 5.31038150e+01, 4.53940387e+01, -3.53082057e+01, -3.72865388e+01, 4.19840247e+01, -1.35105152e+01, -2.08606099e+01, -3.35415737e+01, 3.65901811e+01, -4.03813149e+01, 2.48336400e+01, -4.71853728e+01, 3.75018939e+01, -7.91748458e+00, 5.43218069e+01, -7.22736987e+00, 4.39666795e+01, 3.97256564e+01, -3.79741109e+01, -3.74807012e+01, 1.50133040e+01, 3.18401439e+01, -4.61157131e+01, 5.03882748e+01, 1.81431363e+01, -4.61247995e+01, 4.96739677e+01, 3.89111550e+01, 2.43174294e+00, -7.03632681e+00, 1.86579039e+01, -2.57593652e+00, 2.40046021e+01, -6.59686169e+00, -5.57752419e+01, 1.08254782e+01, -3.23550646e+01, -6.17048407e+01, 3.46197584e+01, -4.39768117e+00, -1.03222265e+01, -2.73390979e+01, -4.65688187e+00, 3.34636093e+00, 4.01091624e+01, -7.99141343e+01, 1.92605199e+01, -3.60403549e+01, -1.68961050e+01, 7.67859619e+00, -5.35309851e+00, 4.99235917e+01, 2.50417875e+01, 4.69413096e+01, 3.62061086e+01, 8.80422839e+00, -4.93537825e+01, -7.15416235e+00, -1.68967704e+01, -1.03626701e+01, 9.81692305e+00, -1.91704184e+01, 4.21350634e+01, -4.02447780e+01, -2.91373860e+00, 2.10828946e+01, 5.42792754e+01, 2.01834876e+01, -2.36620553e+01, -1.94589734e+00, 1.66263919e+01, -6.26561247e+00, -4.67539124e+01, -4.32154035e+01, 2.71490404e+01, 6.01218597e+01, 5.18919703e+01, -3.01441594e+01, -3.68719719e+01, -6.55762514e+01, -1.12053281e+01, -2.13159223e+01, -7.30420634e+01, 4.46663926e+01, 1.45755164e+01, -4.46863548e+01, -1.57996641e+01, -5.74768282e+01, 7.09027337e+01, -1.19788992e+01, -1.47510303e+01, 7.88274633e+00, 1.04025518e+01, -2.36742258e+01, 2.66016995e+01, -1.87515541e+00, -4.24580899e+01, 3.85999420e+01, 8.22712283e+00, -1.28624691e+01, 3.78847160e+01, 3.48232923e+01, -4.90432112e+01, 4.96470277e+01, -5.63013664e+01, 3.30619004e+01, 3.90228877e+01, -5.31747536e+01, -4.75831813e+01, 1.55125613e+01, 2.31748881e+01, 7.62075199e+00, 8.28880238e+00, -1.16097433e+01, 3.55033360e+01, -2.02169782e+01, -3.38793950e+01, 6.66727691e+01, 2.91188770e+01, 1.28697570e+01, -1.97143610e+00, -2.72972445e+01, 2.54511381e+01, 2.97166441e+01, 7.88947744e+01, 7.76990374e+01, -7.51213912e+01, 2.66063912e+01, -4.94068523e+01, 2.50439141e+00, -4.52084847e+01, -2.79466082e+01, 6.95617367e+01, 1.62921703e+01, 5.28473492e+01, 4.75099754e+01, 1.97276053e+01, 7.63824612e+01, 1.75022437e+01, 6.56259455e+01, -4.26176742e+01, -1.83540100e+01, -1.45640997e+01, -3.80632006e+01, -4.57354494e+01, -1.72871534e+01, -4.30461496e+01, -5.47438670e+01, -4.51647581e+01, -1.02080890e+01, -1.74243886e+01, -8.94351255e+00, -3.12927579e+01, -2.91414484e+01, 3.93859142e+01, -5.24654325e+01, 3.39453674e+01, -4.41950040e+01, -3.95513422e+01, 3.47310125e+01, -6.36562376e+00, -3.03025638e+00, 5.34162370e+01, -5.18351899e+01, -3.28090875e+01, -7.32146299e+01, -3.93231805e+01, 4.71106849e+01, 6.55777956e+01, 3.92708701e+01, 3.11350648e+01, -7.37138526e+01, -5.41338048e+01, -1.69418746e-01, -4.00072466e+00, -6.13271183e+01, -4.52814489e+01, -5.46267607e+01, -2.22353924e+01, -3.94160106e+01, -4.46618059e+01, -4.56500891e+01, 5.10335855e+01, 2.96962760e+00, 3.97612243e+01, 2.58854278e+01, 3.47303423e+01, 3.72541019e+01, -4.27066882e+01, -3.28366692e+01, 5.96402717e+01, 6.06704197e+01, -3.57041374e+01, 3.56535104e+01, -5.36710376e+01, -5.69526753e+01, 7.85606860e+01, -6.95909829e+00, -3.50935764e+01, -1.89810804e+01, -4.33402805e-01, 5.62527162e+01, -6.73623190e+01, -1.28289101e+01, 3.67645991e+00, 1.75016162e-01, 5.36971176e+01, 2.82591473e+01, -2.44244820e+01, -4.19535694e+01, 6.73839345e+00, 5.17754108e+01, -4.23073050e+01, -2.11416064e+01, 3.78392913e+01, -5.42195197e+01, -3.91230926e+00, 2.62109368e+01, -7.77670953e+01, 4.48554237e+00, -4.69739965e+01, 4.43163289e+00, -4.01352889e+01, 4.77788891e+01, -2.35259058e+01, 4.90304766e+01, -4.11945198e+01, 4.51344366e+00, 3.30061724e+01, -3.32789816e+01, 2.28701693e+01, -3.60728185e+01, -1.49554531e+01, -3.93193282e+01, -2.99389392e+01, -1.07985640e+01, 3.06467404e+01, -4.44977062e+01, -3.65260748e+01, -2.20908754e+01, 4.39795850e+01, -3.28091973e+01, -3.04334651e+00, -3.46252924e+01, -5.01004016e-01, -1.09280462e+01, -4.33550563e+01, -5.05096607e+01, 4.67165933e+01, -3.52569730e+01, -5.53192384e+01, 1.72436227e+01, 3.43987707e+01, 5.10199894e+01, 1.31849970e+01, 5.44674552e+01, 2.69597495e+01, 3.77208716e+00, 4.69244999e+01, 3.26219293e+01, 3.35862779e+01, 4.75309196e+01, 1.12770145e+01, 2.17057174e+01, 4.04186999e+01, 3.34568798e+01, 5.76283570e+01, -3.00820421e+01, 1.68853785e+01, -2.90537727e+01, -5.11471885e+01, 3.28480543e+01, -4.04627829e+01, 2.08672862e+01, 5.02845400e+01, 4.01487195e+01, -2.30310701e+01, 2.68657982e+01, -4.87158043e+01, -3.60703304e+01, -1.42210630e+01, 2.54508034e+01, 3.12808388e+01, 3.48871909e+01, 3.54195111e+01, -8.61401686e+01, 5.24834919e+01, 5.43492244e+01, -5.06633830e+01, 2.37258959e+01, 3.18695124e+01, -3.58064771e+01, 3.38865819e+01, -4.05207815e+01, -3.26434879e+01, -2.56420659e+01, -3.03467724e+01, 3.88623234e+01, 2.93955319e+01, -1.64941810e+01, 4.15581865e+01, -6.50707257e+00, -6.24751450e+01, 1.63908832e+01, 2.88714308e+01, -8.22492757e+01, 1.49429879e+01, -6.13769445e+01, 4.60179005e+01, -3.64969845e+01, -9.11784913e+00, 7.73212840e+00, 2.66401025e+01, -3.41754197e+01, -2.13449404e+01, 1.62756441e+01, -1.46283327e+01, 2.50184388e+01, -5.48419788e+01, -1.14932259e+01, -3.11275481e+01, 1.88619295e+01, 2.16789527e+01, 2.53980823e+01, -1.52787780e+01, -3.02722370e+01, 5.82770143e+01, 4.24803534e+01, -1.12549749e+00, 3.46335993e+01, -3.36136983e+01, -3.87169932e+01, 1.65967945e+01, 2.47551944e+01, 3.33023216e+01, -2.82538070e+01, 2.29675365e+01, 5.35362302e+01, -5.41257770e+01, -3.35072182e+01, -8.13749218e+01, -2.92587247e+01, 5.79788572e+01, 4.53342612e+01, -2.77356870e+01, -6.88136986e+01, 1.56644146e+01, 3.12884641e+00, -5.33294256e+01, 5.04822645e+01, -6.80207207e+01, 1.40046232e+01, 4.99902079e+00, 4.77618634e+00, -4.27970774e+01, -4.84885006e+01, 2.66402263e+01, 3.95119546e+01, 3.60863745e+01, -4.74079348e+01, -5.20827961e+01, 4.60887694e+01, 4.05395955e+01, -2.42309212e+01, 7.80232943e+01, -4.05624242e+01, -1.36860745e+01, 7.98055189e+01, -4.33587095e+01, 2.90723726e+01, 6.66157749e+01, -4.43561845e+01, 1.17272419e+01, 5.05299688e+01, 5.39564007e+01, 8.97819076e+00, -7.36843627e+01, -2.45479874e+01, -2.34449284e+01, 4.31782527e+01, 3.46120736e+00, -4.45693170e+01, -5.21756896e+01, -3.63035337e+01, 6.35667197e+01, -2.37135800e+01, -5.16598869e+01, 2.71590023e+01, -4.88400391e+01, -1.84213515e+01, 4.23681844e+01, -4.95847664e+01, 1.75163419e+01, 2.94814176e+01, -3.03957280e+01, 4.86867780e+01, 1.01099692e+01, 3.69796971e+01, 5.60728010e+01, 4.04960315e+01, 3.29422401e+01, 2.72880019e+01, -6.84499489e+01, -2.13580714e+01, 1.35933196e+01, 7.66352323e+01, 1.59255013e+01, -4.25114640e+01, -7.25535515e+01, -7.17771497e+01, -5.76575982e+01, -3.29957132e+01, -6.26471330e+01, -2.40909611e+01, 4.32603543e+01, -4.77758298e+01, 1.41679520e+01, -6.00922514e+01, -4.87930312e+01, 3.50211235e+01, -1.42523005e+01, -2.67346987e+01, 4.11409057e+01, 4.58812286e+00, 6.26170577e+01, -9.17161983e+00, 2.55336576e+01, -3.25097289e+01, -4.10408626e+01, -1.88030155e+01, -4.09645903e+01, -3.03902276e+01, -1.74285256e+01, -4.12560841e+01, 4.56352877e+01, -7.50112495e+01, 1.94726467e+01, 3.39201221e+01, -3.97596720e+01, -6.13952164e+00, 9.44094818e+00, -5.33558250e+01, -1.78193081e+01, -2.68606000e+00, -7.53509203e+00, 3.95376747e+01, -4.16075605e+01, -3.59187318e+01, -5.05202719e+01, 1.54469194e+01, 4.28655191e+01, 1.02853154e+01, -4.45449445e+01, -1.35089464e+01, -9.67206537e+00, 3.90102173e+01, 1.55815633e+01, -3.87533459e+01, -2.08009517e+01, -4.60773384e+01, 2.08566257e+01, -3.98323039e+01, -3.73063371e+01, -1.66990344e+01, 2.72644979e+01, 7.82472667e+01, 3.23230084e+01, -5.14401506e+01, 2.59755363e+01, 1.62594394e+00, -9.24570147e+00, 2.26426937e+01, 2.64372790e+01, -1.21963647e+01, -2.55273525e+00, 1.56158253e+01, -9.35145443e+00, 4.56272268e+01, -5.48967193e+01, 5.62653429e+01, -4.48854314e+01, 1.93530934e+01, 6.26695373e-02, -2.84745005e+01, -3.84879348e+01, 1.99933291e+01, -2.86012995e+01, -2.29390178e+01, -4.75571349e+01, 2.15457824e+01, 3.84251583e+01, 1.09772711e+01, -2.43777707e+01, -1.16167418e+01, 3.54083397e+01, -1.69141810e+01, -3.98387919e+00, 2.74698338e+01, 4.57295453e+01, -4.59904057e+01, 1.90217330e+01, 4.56701531e+01, 1.65806082e+01, 3.79929330e+00, -4.42741603e+01, -4.44803854e+01, 2.87502823e+01, -2.78155697e+01, 2.04323601e+01, 4.18667130e+01, -3.59215289e+01, -5.29453245e+01, -3.11360983e+00, 3.11782934e+01, 4.18419008e+01, 5.08445531e+01, 4.01356050e+00, 4.35260092e+01, -3.17918682e+01, -2.74191740e+01, 5.02776740e+01, 6.91718170e+01, -3.68174463e+01, 1.37628629e+01, 2.31947714e+01, 2.64663863e+01, 8.81969119e+00, 1.01979091e+01, 4.48762212e+01, -1.24545952e+01, 1.90707313e+01, 5.89837762e+01, -4.03356743e+01, -3.76515065e+01, 3.26027369e+01, 1.15233687e+01, 2.08282619e+00, -1.45577534e+00, 7.69404795e+01, 7.79902235e+01, -6.71800261e+00, 1.38686065e+01, -3.84658935e+01, -3.50687148e+01, -1.14748155e+01, 3.78030321e+01, 6.85643246e+00, -1.45077109e+01, 1.55254299e+01, 2.52440383e+01, -2.78335693e+01, -5.39320013e+01, 3.70599434e+01, -1.36127481e+01, -3.93095446e+01, 8.21413849e+00, 3.96736292e+01, -4.69657641e+01, 4.72074795e+01, -2.60033663e+01, -5.01364855e+00, 7.70827583e+01, 5.09163249e+01, 5.12589689e+01, 5.58714082e+00, -4.42186231e+01, 2.49335676e+01, -9.95295540e-01, -2.58172683e+01, 4.58335603e+01, 4.10347936e+01, -1.25179863e+01, -3.02496873e+01, 5.58599292e+01, 7.93046679e+01, -1.43995379e+01, 4.02093211e+01, -1.19297822e+01, 1.54064130e+01, -2.37962599e+01, 2.80400040e+01, -2.03000089e+01, 4.90528352e+01, 6.99393455e+01, 2.62746329e+01, -2.89259804e+01, 3.61417133e+01, -1.54521217e+01, 1.61943944e+01, -2.42698474e+01, -2.16054235e+01, 4.81902571e+01, 2.06148036e+01, 3.27337111e+00, 8.09840613e+00, -7.74979244e+00, 3.46810271e+01, -3.42715512e+01, 5.02224567e+00, 4.74073290e+01, -4.74242102e+01, -4.92132677e+00, -4.23302676e+01, -4.89865639e+01, 3.21042193e+00, -8.88321847e+00, 5.27544333e+01, 1.89036909e+01, -6.15429624e+00, 4.28096261e+01, 4.34460591e+01, 7.36325777e+01, 1.10996130e+01, 2.45505169e+01, 3.24247447e+01, -1.13225267e+00, 3.26418188e+01, 3.05230139e+01, -6.55738617e+00, 5.68545092e+01, -1.76596103e+01, 3.45973504e+01, 2.84962203e+01, 3.94208645e+01, 4.77604600e+01, -4.41011429e+01, 3.18266099e+01, 3.03014077e+01, -3.77591119e+01, 2.87793190e+01, -5.08987742e+01, -2.72074982e+01, 7.90339995e+01, 3.85775302e+01, -2.29032673e+01, -2.28605509e+01, 5.97220860e+01, 1.48493251e+01, 9.64260336e+00, -2.16659419e+01, 2.42411259e+00, -1.71058179e+01, 1.22990461e+01, 2.54700723e+01, 1.65952363e+01, 1.69087953e+01, 4.52049806e+01, -5.94953392e+01, -4.35896505e+01, -3.28959931e+01, 4.42470639e+01, -4.09705339e+01, 2.35730462e+01, -3.78865952e+01, -3.74111015e+01, -5.08109341e+00, 3.74243514e+01, 5.78309967e+01, -3.45779622e+01, -5.01481299e+01, -4.84410944e+01, 7.80516428e+01, -3.30497898e+01, -4.67273646e+01, -2.27464738e+01, 3.11590647e+01, -6.40543181e+01, -1.76274530e+01, 3.71204529e+01, 5.61726494e+01, 2.66455146e+01, -3.10525167e+01, 7.09387348e+00, 6.11395062e+01, -3.86383233e+01, 2.42056231e+00, -1.33102041e+01, -4.83932970e+01, -1.07125465e+01, 3.93223270e+01, -2.60757340e+01, -6.91776144e+01, 3.60535440e+01, -3.34679818e+01, 3.76444784e+01, 5.48312014e+01, 7.24396116e+01, 4.37489435e+01, 1.52436361e+01, 4.46700196e+01, 4.10970411e+01, 8.34697082e+01, -6.89667978e+01, 3.52487587e+01, 4.19896130e+01, 1.94342494e+01, 4.58358712e+01, -2.94681509e+01, 5.15223603e+01, -7.20804034e+01, -1.99627388e+00, 3.80364408e+01, -2.63855858e+01, 2.38614248e+01, 7.51358941e+00, -4.40929999e+01, 1.00962768e+01, -6.76205914e+01, 2.50185589e+01, -1.83019886e+01, 6.11331349e+01, -5.22600220e+01, 2.98301885e+00, 1.90212743e+00, -2.25911930e+01, -4.12882105e+01, 9.67669773e-01, -2.64344552e+01, 7.24797832e+00, 8.28445892e+01, 2.23328465e+01, -4.91503323e+01, -3.19937019e+01, -3.73579968e+01, 7.26779104e+00, -7.71067520e-01, -3.46908475e+01, -3.95621428e+01, 3.92914420e+01, 3.94067676e+00, -5.25472428e+01, -3.68826463e+01, -3.84736349e+01, -2.20732488e+01, 5.41543707e+01, -4.53227715e+00, 3.00859554e+01, 6.60857015e+01, 2.76991625e+01, 5.43329453e+01, 3.98845780e+00, 9.64740324e+00, 3.40477221e+01, -3.28261998e+01, -1.22917302e+01, -4.69022168e+01, 2.69308302e+01, -4.42848056e+01, -5.49266171e+01, -6.94347660e+01, 3.32742963e+01, 2.59353965e+01, 3.44483184e+01, 4.88195563e+01, 6.34286543e+01, 2.61711197e+01, -6.14493139e+01, -2.36184769e+01, 3.43644245e+01, -3.55976826e+01, -5.38145881e+01, 4.56819592e+01, 4.34807407e+01, -3.50052299e+01, -4.02534407e+01, -5.91226556e+01, -2.39653655e+01, -1.43191887e+01, 6.50501949e-01, -4.13637063e+00, -4.71061193e+01, -2.37245965e+01, 4.07957839e+01, -3.03284335e+00, -4.89656764e+01, -8.53979897e+01, 1.99928786e+01, -4.29194104e+01, -4.30378709e+01, -3.47543100e+01, 6.10071407e+01, -5.10591296e+01, 3.68920699e+01, 3.27647212e+01, 3.39469061e+01, -2.11531226e+01, -4.68553624e+01, -1.33332506e+01, -2.94167560e+01, -6.12449946e+01, 3.62148900e+01, -5.41687754e+01, -4.25301721e+01])
    • local_time
      (location, local_time)
      float64
      s
      0.0, 3600.0, ..., 0.0, 3600.0
      Values:
      array([[ 0., 3600., 7200., ..., 75600., 79200., 82800.], [79200., 82800., 0., ..., 68400., 72000., 75600.], [14400., 18000., 21600., ..., 3600., 7200., 10800.], ..., [75600., 79200., 82800., ..., 64800., 68400., 72000.], [46800., 50400., 54000., ..., 36000., 39600., 43200.], [ 7200., 10800., 14400., ..., 82800., 0., 3600.]])
    • (location, local_time)
      float64
      counts
      4.43, 4.11, ..., 1.47, 1.23
      Values:
      array([[4.42867341, 4.111534 , 3.37538692, ..., 4.79696001, 5.20675205, 3.92567206], [5.34583922, 4.60467457, 4.58817595, ..., 5.93446155, 5.40293595, 5.37248551], [2.44323171, 2.65079757, 2.05276799, ..., 3.62634687, 2.75139533, 3.07662151], ..., [6.19607892, 5.51764126, 4.51106706, ..., 6.67223947, 5.69698029, 5.44387367], [3.48840011, 4.25009532, 3.90619928, ..., 2.54831688, 2.74286982, 3.25032765], [1.10164453, 1.16961296, 1.01363951, ..., 2.41102182, 1.46876642, 1.22548782]])
    • datetime
      (local_time)
      datetime64
      s
      2021-06-01T17:00:00, 2021-06-01T18:00:00, ..., 2021-06-04T15:00:00, 2021-06-04T16:00:00
      Values:
      array(['2021-06-01T17:00:00', '2021-06-01T18:00:00', '2021-06-01T19:00:00', '2021-06-01T20:00:00', '2021-06-01T21:00:00', '2021-06-01T22:00:00', '2021-06-01T23:00:00', '2021-06-02T00:00:00', '2021-06-02T01:00:00', '2021-06-02T02:00:00', '2021-06-02T03:00:00', '2021-06-02T04:00:00', '2021-06-02T05:00:00', '2021-06-02T06:00:00', '2021-06-02T07:00:00', '2021-06-02T08:00:00', '2021-06-02T09:00:00', '2021-06-02T10:00:00', '2021-06-02T11:00:00', '2021-06-02T12:00:00', '2021-06-02T13:00:00', '2021-06-02T14:00:00', '2021-06-02T15:00:00', '2021-06-02T16:00:00', '2021-06-02T17:00:00', '2021-06-02T18:00:00', '2021-06-02T19:00:00', '2021-06-02T20:00:00', '2021-06-02T21:00:00', '2021-06-02T22:00:00', '2021-06-02T23:00:00', '2021-06-03T00:00:00', '2021-06-03T01:00:00', '2021-06-03T02:00:00', '2021-06-03T03:00:00', '2021-06-03T04:00:00', '2021-06-03T05:00:00', '2021-06-03T06:00:00', '2021-06-03T07:00:00', '2021-06-03T08:00:00', '2021-06-03T09:00:00', '2021-06-03T10:00:00', '2021-06-03T11:00:00', '2021-06-03T12:00:00', '2021-06-03T13:00:00', '2021-06-03T14:00:00', '2021-06-03T15:00:00', '2021-06-03T16:00:00', '2021-06-03T17:00:00', '2021-06-03T18:00:00', '2021-06-03T19:00:00', '2021-06-03T20:00:00', '2021-06-03T21:00:00', '2021-06-03T22:00:00', '2021-06-03T23:00:00', '2021-06-04T00:00:00', '2021-06-04T01:00:00', '2021-06-04T02:00:00', '2021-06-04T03:00:00', '2021-06-04T04:00:00', '2021-06-04T05:00:00', '2021-06-04T06:00:00', '2021-06-04T07:00:00', '2021-06-04T08:00:00', '2021-06-04T09:00:00', '2021-06-04T10:00:00', '2021-06-04T11:00:00', '2021-06-04T12:00:00', '2021-06-04T13:00:00', '2021-06-04T14:00:00', '2021-06-04T15:00:00', '2021-06-04T16:00:00'], dtype='datetime64[s]')
    • local_datetime
      (location, local_time)
      datetime64
      s
      2021-06-02T00:00:00, 2021-06-02T01:00:00, ..., 2021-06-05T00:00:00, 2021-06-05T01:00:00
      Values:
      array([['2021-06-02T00:00:00', '2021-06-02T01:00:00', '2021-06-02T02:00:00', ..., '2021-06-04T21:00:00', '2021-06-04T22:00:00', '2021-06-04T23:00:00'], ['2021-06-01T22:00:00', '2021-06-01T23:00:00', '2021-06-02T00:00:00', ..., '2021-06-04T19:00:00', '2021-06-04T20:00:00', '2021-06-04T21:00:00'], ['2021-06-02T04:00:00', '2021-06-02T05:00:00', '2021-06-02T06:00:00', ..., '2021-06-05T01:00:00', '2021-06-05T02:00:00', '2021-06-05T03:00:00'], ..., ['2021-06-01T21:00:00', '2021-06-01T22:00:00', '2021-06-01T23:00:00', ..., '2021-06-04T18:00:00', '2021-06-04T19:00:00', '2021-06-04T20:00:00'], ['2021-06-02T13:00:00', '2021-06-02T14:00:00', '2021-06-02T15:00:00', ..., '2021-06-05T10:00:00', '2021-06-05T11:00:00', '2021-06-05T12:00:00'], ['2021-06-02T02:00:00', '2021-06-02T03:00:00', '2021-06-02T04:00:00', ..., '2021-06-04T23:00:00', '2021-06-05T00:00:00', '2021-06-05T01:00:00']], dtype='datetime64[s]')
    • location
      (location)
      vector_3_float64
      km
      [ 571.77868666 -4281.40448273 4683.1918377 ], [-1666.0407522 -3598.38919433 4986.53631473], ..., [-1866.92481414 3228.67850162 -5165.25583795], [ 2800.88390772 -3767.94184384 -4306.65817043]
      Values:
      array([[ 571.77868666, -4281.40448273, 4683.1918377 ], [-1666.0407522 , -3598.38919433, 4986.53631473], [ 3669.6763539 , -1548.02332804, 4972.59894154], ..., [-3142.51443669, -4067.66649023, 3764.08466157], [-1866.92481414, 3228.67850162, -5165.25583795], [ 2800.88390772, -3767.94184384, -4306.65817043]])
    • longitude
      (location)
      float64
      deg
      -82.39, -114.84, ..., 120.04, -53.37
      Values:
      array([-8.23931976e+01, -1.14843960e+02, -2.28720563e+01, -1.32782942e+01, 1.48640346e+02, 1.26221456e+02, -7.18161322e+01, -1.70774953e+02, -1.37068731e+02, -1.09271276e+02, 4.97432566e+01, 6.30753424e+01, -2.49216957e+01, 8.76932524e+01, -1.38820347e+02, -1.42401404e+02, -1.19948408e+02, 3.80255495e+01, 4.13614948e+01, -3.95684615e+01, 2.05603581e+01, 4.16201692e+01, -9.32015999e+01, -2.44181075e+01, -1.56718369e+02, 5.78656131e+00, 7.49465958e+01, -2.97955956e+01, -1.04378917e+02, -1.51852180e+02, 3.79560640e+01, 9.07196194e+01, 2.81754113e+01, -8.09706770e+01, -1.13814120e+02, -1.18148070e+02, 2.93966709e+01, 1.02009738e+02, 1.47322981e+02, -1.32664857e+02, 1.16245355e+02, 4.73748967e+01, -5.86201085e+01, -1.42762352e+02, -1.21655818e+02, 2.76856595e+01, 1.26134565e+02, -1.79236211e+02, -1.67530022e+02, -2.20797349e+01, 7.96679321e+01, 1.92530621e+01, 7.67542625e+01, 1.32406233e+02, -1.10689569e+02, 1.00544679e+02, 4.61060543e+01, 1.49109308e+02, 4.28776518e+01, -1.58170646e+02, -7.99055722e+01, 1.75085569e+02, 1.64971266e+02, 7.44425753e+01, -2.62504774e+01, 1.36246586e+02, -8.10649296e+01, 7.28047396e+01, 1.51758236e+02, 1.32502209e+01, 9.45648196e+01, -4.02450817e+01, 1.33815764e+02, -8.67808899e+01, 1.78737509e+02, 1.09469249e+02, -9.15571897e+01, -1.51845160e+02, -1.43447537e+02, 2.97888838e+01, 2.84304085e+01, -2.84994772e+00, -1.33674336e+02, -1.17435936e+02, 1.37528133e+02, -8.30118143e+01, 1.39382071e+02, -2.41078645e+01, -1.55985613e+02, -1.45539812e+02, 3.00490265e+01, -6.95373006e+01, -6.46148088e+01, 1.08261088e+02, -5.58042888e+01, 4.29966387e+01, -9.49975297e+01, 7.98935486e+01, 7.61471849e+01, -1.02810052e+01, 5.80622908e+01, -1.03973931e+02, 6.76748231e+01, 1.49937188e+02, 1.76937819e+02, -1.71111444e+02, -8.12537576e+01, -1.23569787e+02, -2.11355596e+01, 1.28272253e+02, 1.30050194e+02, 3.08416951e+00, 7.59746300e+01, -3.39568324e+01, 9.88779331e+01, -1.21098653e+02, -1.30275550e+02, 1.64134127e+02, 1.05236424e+02, -1.56375625e+02, 1.51574179e+02, -9.42125670e+01, 6.47222957e+01, 1.37208277e+02, 1.25869925e+01, -5.55167678e+01, 1.15564777e+02, -1.64988634e+02, 1.42799965e+02, -1.04420288e-01, 1.68599373e+02, -1.24547046e+02, -8.35632521e+01, 1.26540280e+02, -3.02083198e+01, -1.20365371e+02, 5.95962511e+01, -1.59284512e+02, 1.79764012e+02, -2.05356394e+01, 1.32513429e+02, 1.72178081e+02, -1.62627189e+02, 4.29135883e+01, -5.85441911e+01, -1.47980540e+02, 1.98556567e+01, -1.11266795e+02, -2.41613542e+01, 1.19958869e+01, -2.99138488e+01, 9.79069352e+01, 1.35696634e+01, -5.98827039e+01, 7.69559621e+01, -6.03099605e+01, 1.65080531e+02, 1.11687391e+01, 2.82262367e+01, 1.54415872e+02, 6.63873171e+01, 1.00894547e+02, 3.21683336e+01, -1.24957445e+02, -1.17669226e+02, 4.14046876e+00, 4.92380362e+01, 4.17227782e+01, -1.95512060e+01, -3.40281787e+01, -9.18676745e+01, -1.55148030e+02, -1.34810770e+02, 1.22699796e+02, -1.91320098e+01, -1.28387039e+02, -1.27805545e+02, -3.68115753e+01, -4.78764984e+01, 1.08983293e+02, -5.09272497e+01, -1.68022753e+02, -1.65594082e+02, -9.64230478e+01, -8.97942693e+01, 1.39098186e+02, -8.73880918e+01, -1.29475265e+02, -9.23992654e+01, 6.23944098e+01, -1.24709474e+02, -1.31716764e+02, 7.06502244e+01, -1.76895885e+02, 7.24366145e+01, -4.03255634e+01, -1.51174858e+02, -5.48458464e+01, 3.01677483e+01, -1.20113289e+02, 1.51077098e+02, -1.12956475e+02, 7.91599042e+01, 1.48463594e+01, -1.33380435e+02, -9.90911554e+00, 1.20936207e+02, 1.09542984e+02, 1.14755028e+02, -2.10898575e+01, -1.00615636e+02, -1.22191784e+02, -1.11292419e+01, 1.38749239e+02, 1.56438679e+02, 6.48591763e+01, 9.94227926e+01, 4.90812479e+01, 2.18739650e+01, -6.04900861e+01, 3.93438171e+01, -1.76590076e+02, -1.47461431e+02, -1.39930087e+01, 1.12481371e+02, 1.64024809e+02, 9.12699721e+01, -1.29500473e+02, 3.20908812e+01, 1.68886755e+02, 1.19456820e+02, 1.24041183e+02, 1.74524582e+02, -1.19685252e+02, -3.20930069e+01, -1.34142994e+02, -7.86013548e+01, 5.14391153e+00, 1.13617848e+02, 1.40973662e+02, 3.76147297e+01, -9.32706847e+01, -3.54047795e+01, 1.43227311e+02, -1.30537089e+02, -1.18334368e+02, 1.57000415e+01, -1.17118775e+02, 1.48041297e+02, -7.51655954e+01, 5.51214332e+01, -1.49928448e+02, -1.57309883e+02, 1.08556010e+02, -7.07171882e+00, 1.27482927e+01, -1.43661960e+02, -7.34517211e+01, -3.51148165e+01, -5.40081020e+01, 4.04112441e+00, 1.66531154e+02, -7.89590886e+01, 2.74221593e+01, 1.39016125e+02, 1.25739965e+02, 1.44005571e+02, -1.72771361e+02, -1.11427614e+02, 1.59476609e+02, -1.83657171e+01, 1.54616526e+02, 1.74106475e+02, 1.32048860e+02, -1.56815732e+02, -1.73385369e+02, 1.07820684e+02, 1.16807222e+02, 1.36508889e+02, -4.42948743e+01, 3.18233169e+01, -3.95348817e+01, -7.71321630e+01, -1.77014479e+02, 4.25532618e+01, -1.19627118e+01, 1.25918016e+02, -1.26003864e+02, -1.51417716e+02, -3.07328374e+01, 8.26476874e+01, -1.32297448e+02, -8.31270865e+00, 7.19048659e+01, 8.21136886e+01, -4.13301117e+01, 1.59833662e+02, -8.84090811e+01, 1.34471486e+02, 7.18952177e+01, 1.61053729e+02, -1.37792790e+02, 1.57861076e+02, -2.79060025e+01, 1.28714707e+02, 2.74972038e+01, -9.61621098e+01, -5.07525778e+01, -4.44561575e+01, -1.22554126e+02, 4.22414614e+01, 3.77594654e+01, 1.73752784e+02, -6.38634321e+01, -1.45973831e+01, -1.32731531e+02, 1.36685504e+02, 4.05139412e+01, -4.78893838e+01, 1.41173004e+02, -1.34055948e+02, -4.89652677e+01, 9.55704018e+01, 7.22922293e+01, -9.39131535e+01, -1.59462911e+02, 6.62955839e+01, 1.06657661e+02, -1.31742104e+02, 1.59110286e+02, -1.19777640e+02, 1.12591177e+01, 6.01653366e+01, -1.70116472e+02, 3.61993394e+01, -7.26849181e+01, -1.32849282e+02, -1.79635577e+02, -1.50383623e+02, -2.24463535e+01, 1.51690030e+02, 5.30986551e+01, 4.16424276e+01, 6.44014391e+00, 1.64805462e+02, 1.29289072e+02, 1.17100991e+01, -2.75582545e+01, 9.80008859e+01, -4.08920176e+01, -5.02506314e+01, 7.41034571e+01, 1.15112213e+02, -1.39957838e+01, 4.09295500e+00, -1.38852721e+02, -1.78325863e+02, -1.46976699e+02, -1.65802375e+02, -7.25499263e+01, -1.34753024e+02, -1.12969655e+01, -1.08906511e+02, 1.41417471e+02, -3.94906149e+01, -9.24486505e+01, -7.01700862e+01, 5.47855860e+01, -3.83196607e+01, 1.58246785e+02, 1.18213739e+02, 1.41294285e+02, -9.95890474e+00, -1.11537010e+02, 1.07985936e+02, 1.08750149e+02, 5.62808607e+01, 2.81114942e+01, 1.78053295e+02, -1.42200588e+02, -2.90060105e+01, 1.43310152e+02, 8.52895745e+01, -1.40705736e+02, 7.61967993e+01, -1.08900307e+02, -8.20222444e+01, 7.45486373e+01, -1.04943222e+02, -3.36178937e+01, 4.70603411e+01, -1.11930797e+02, 1.04411965e+01, 2.99519074e+01, -1.37257544e+02, 4.22258744e+01, -3.94469216e+01, 1.17410306e+02, 1.51615645e+02, 4.48800444e+01, -8.38086309e+01, 1.89890480e+01, 3.64339418e+01, 1.47513591e+02, -1.76535291e+02, -1.52539180e+02, -1.12339971e+02, 6.51264945e+01, 2.31620706e+01, -1.05617747e+02, -1.83984419e+01, -1.58309628e+02, 1.39473549e+02, -5.57740981e+01, -1.32910124e+02, 1.26356801e+02, -1.71388962e+02, -1.47780758e+02, -1.61614071e+01, -2.16848571e+01, 1.68811439e+02, 3.30413091e+01, -1.37219863e+02, 5.02133115e+01, 3.64795921e+01, -3.25502306e+01, 1.26631063e+02, -1.13458863e+02, 1.36301459e+01, 8.63362227e+01, -1.96935929e+01, 7.81621062e+01, 1.28814412e+02, 5.26439036e+01, 1.35407142e+02, 1.38195046e+01, -1.50115384e+02, 1.24426322e+02, -1.17771068e+02, 4.68021860e+01, -6.93991286e+01, 5.10773566e+01, 5.54147745e+01, -1.56081760e+02, -5.65955975e+01, -1.36750559e+02, -1.44147752e+02, -7.70281086e+01, 9.50992901e+01, 4.38440811e+01, -4.12477799e+01, 4.75766009e+01, -1.31867439e+02, -3.84448721e+01, -3.47787459e+01, -1.78601862e+02, -1.19427355e+02, -4.64841427e+01, -1.56174421e+02, 9.10034042e+01, 2.44554826e+01, 1.05863688e+02, 4.88855430e+01, 6.35842746e+01, -1.74464162e+02, -6.04154113e+01, -1.28113708e+02, -1.35310222e+02, -9.21919148e+01, -3.30945158e+01, -1.24143596e+02, 3.22242311e+01, 6.78198139e+01, -3.95447930e+00, 7.66441864e+01, -1.38109130e+02, 1.36318555e+02, 2.26194545e+01, -1.77308176e+01, -1.61351350e+02, 5.45428270e+01, -1.15703862e+02, -1.55663624e+02, -5.00779203e+01, -1.32659698e+02, -1.32701142e+02, 1.84088595e+01, -5.45086544e+01, -1.35268600e+02, -1.23893602e+02, -1.49007198e+02, 1.46537705e+02, 6.33495522e+01, -5.47586643e+01, 1.50299747e+02, -1.53658071e+02, -1.52091896e+02, -6.20800061e+01, 1.77554041e+02, 3.57015962e+01, -1.32392306e+02, 2.18221463e+01, -1.51506686e+02, -1.71451855e+02, 1.79247317e+02, -2.36710371e+01, 1.68086133e+02, -1.29180161e+02, -1.14114525e+02, 8.93667520e+01, -1.91636435e+01, 3.32253577e+01, -2.04237686e+01, 1.11037718e+02, 3.99524425e+01, -1.48233888e+02, 1.38926364e+02, 6.41030511e-01, 6.90967820e+01, 1.57336393e+02, -1.48449539e+02, 3.58743593e+00, -5.82037923e+01, 1.53461021e+02, -1.33695920e+02, 2.80984172e+00, 6.12431501e+01, 3.55989093e+01, -1.36212432e+02, -6.59764845e+01, -1.23173904e+02, 8.18754308e+01, 5.63687549e+01, -1.18431568e+02, 3.06064795e+01, -3.71989295e+00, -4.91278619e+00, 3.50903688e+01, 9.53872874e+00, -1.33106723e+02, 1.75546593e+02, 1.63510075e+01, 1.04476010e+02, -3.46034354e+01, 7.10335528e+01, -3.89365796e+01, -3.28017687e+01, 1.50062410e+02, 5.25195418e+01, 6.42523031e+01, 8.82433740e+01, 1.05916025e+02, -1.11725738e+02, 1.75163149e+02, -7.05449765e+01, 3.07423516e+01, 1.72882847e+02, -1.35287191e+02, 4.46120462e+01, 1.27800467e+02, -1.06747884e+02, 2.11071048e+01, -2.82934349e+01, -1.55853435e+02, -1.26733888e+02, -4.84674573e+01, 9.89449361e+01, 1.78262219e+02, 1.64717871e+02, -1.08730245e+02, 1.05121079e+02, -1.77761054e+02, -7.64441032e+01, -6.59759786e+00, -1.43910337e+02, 1.67559044e+00, 8.05143751e+01, -9.84309664e+01, 6.62154258e+01, 3.85020289e+01, -1.26734935e+02, -5.28946044e+01, 1.57394075e+02, -2.81737565e+01, -7.17867602e+01, -4.31606141e+01, 4.83802012e+01, -3.69108915e+01, -8.11590330e+00, -8.76026173e+01, 7.41125611e+01, -4.51101858e+01, 4.16302717e+01, 2.21865725e+01, 1.76765117e+02, 2.64664324e+01, 1.25507625e+02, 5.17374892e+01, -5.89565135e+01, -5.50451793e+01, 1.41907702e+02, -6.32200919e+01, 6.42771427e+01, 4.97807006e+01, -1.58792408e+02, -1.32158139e+02, -1.62225660e+02, 3.81473137e+01, 1.79944958e+02, 1.77790327e+02, -1.44327366e+02, -7.08645449e+01, 8.84431433e+01, -1.33441371e+02, -5.56641957e+01, 1.58955197e+02, -1.65747366e+02, -7.44608581e+01, 6.09631670e+01, -1.44285991e+02, 1.75257598e+02, -1.05126444e+02, 1.54395617e+02, 1.65518684e+02, -1.65969042e+02, 1.46794755e+02, 1.27184196e+02, 1.16140331e+02, -2.98024532e+01, -2.62279472e+01, 1.58420301e+02, 1.16192295e+02, 1.16694087e+02, -3.40405433e+01, -6.66210913e+01, -7.17995940e+01, -4.82001356e+01, -4.82238052e+00, -1.15035381e+02, -1.10725036e+02, -4.83773297e+01, -9.71294687e+01, 4.98987014e+01, -3.69264458e+01, -6.81186750e+01, -1.60467592e+02, 9.18875346e+00, -1.76950824e+02, -8.01654804e+01, -5.58661881e+00, -4.36450953e+01, 1.64108830e+02, -1.73337592e+02, -1.02811548e+02, 1.61584473e+02, 1.65508257e+02, -1.11296940e+02, 9.79995522e+01, -5.11782927e+01, 1.72917122e+02, 1.19302612e+02, -3.65478632e+01, -1.33111364e+02, 1.48499228e+02, 6.34242489e+01, 1.26916817e+02, 1.69073472e+02, 1.71172957e+02, -1.17371344e+02, 2.23254735e+01, 9.36752284e+01, -1.42152281e+02, -6.62575391e+01, -1.19204652e+02, 5.49825510e+01, -3.84264687e+01, 1.59977132e+01, 1.77823674e+02, -1.18273214e+02, 5.29570704e+01, 1.49352543e+02, -7.49199766e+01, -1.40596820e+02, 8.96207532e+00, 2.04560355e+01, -1.42428301e+02, -1.54922705e+02, -6.34819890e+01, 1.13374147e+02, -1.67922560e+02, 1.44303098e+02, 1.00679439e+02, 4.92605127e+01, 4.81155365e+01, 1.79361088e+02, 4.93230920e+01, 1.30244961e+02, -3.49598711e+01, -1.64252920e+02, 1.46795900e+02, -9.91959716e+01, -1.43967296e+02, -1.93818042e+01, 1.67007056e+02, -1.44195021e+02, -9.37221566e+01, -1.03334418e+02, 8.77555097e+01, 1.28256142e+02, -4.09076691e+01, -4.71568485e+01, 1.13513265e+02, 5.18813528e+01, -1.47838199e+02, 1.53818904e+02, 2.79676704e+01, -6.30592607e+01, 6.99246636e+01, 1.18837304e+02, -4.25919612e+01, 1.50724166e+02, -7.40970636e+01, 4.72952454e+01, 6.80747661e+01, 1.19144482e+02, -7.28739480e+01, 1.40904887e+02, 1.75355324e+02, 1.39548048e+02, -1.65559114e+02, 9.18206050e+01, 1.51754441e+02, -6.18492609e+01, 4.16205245e+01, -1.71928135e+02, 1.50715939e+02, -1.08296308e+02, -1.02406576e+02, 4.18055324e+01, -1.34560037e+02, -6.13778229e+01, -4.00955045e+01, 1.10493137e+02, -6.66538906e+01, -4.29057093e+01, 8.90113962e+01, -7.82381306e+01, 4.87421587e+01, -4.25880532e+01, 1.26149995e+02, 1.19167695e+02, -2.71847465e+01, -1.05562991e+01, -1.40138112e+02, 1.33120825e+02, 1.54431692e+02, 1.40190803e+02, -7.72725760e+01, -1.37178411e+02, -1.27780061e+02, 1.29996497e+02, -1.45073541e+02, 1.41469529e+02, -1.11312225e+02, 7.21269156e+01, 3.81493804e+01, 3.20428329e+01, -2.24072449e+01, -1.39027405e+02, 9.57033944e+01, 5.53032758e+01, -4.92233688e+01, -9.95705123e+01, 1.37157166e+02, 4.63978896e+01, 3.42867128e+01, -9.09363395e+01, 1.45404337e+02, 5.76022201e+01, -1.18134082e+02, -2.73042153e+01, 5.51119133e+01, 6.85850200e+00, 1.38826913e+02, -1.04376950e+02, 2.34266981e+01, -3.12501451e+01, 5.10358480e+01, -1.20675453e+02, -5.55848554e+01, 1.20329413e+02, -1.28319867e+02, 1.34787411e+02, 1.14561125e+02, -1.26123260e+02, -1.58790381e+02, -1.28193756e+02, 5.66234108e+01, 8.18145905e+01, -9.84271786e+01, -1.50894245e+02, -1.32595588e+02, -5.57017710e+01, -2.88134403e+01, 1.24721062e+02, 1.15557877e+02, 2.02784979e+01, -1.53161563e+02, -1.52278440e+02, -4.53741860e+01, -9.47330459e+01, -4.01847493e+01, -9.24095517e+00, 1.34746180e+02, 5.54190020e+01, 1.46884975e+02, 9.02474409e+01, 4.38239110e+01, 1.23728429e+02, 9.38041349e+01, 6.04379880e+01, -1.07197296e+02, 1.65854534e+02, 1.48192156e+02, -4.67636137e+01, -1.38895864e+02, -1.41350790e+02, 1.71175768e+02, 9.99794837e+01, 4.51862192e+01, -7.06829201e+01, -8.14634508e+01, -4.66076005e+00, -1.47534713e+02, 1.50656086e+02, 5.01748385e+01, -6.59593274e+01, -1.04575739e+02, 1.00868028e+02, 4.75878778e+01, 9.38416598e+01, 5.92919284e+01, 2.74486490e+01, -4.05154299e+01, -1.32333433e+02, -7.85682385e+01, 4.60393083e+01, 1.55827062e+02, 1.53502663e+02, 9.79921735e+01, -8.14926625e+01, -1.30303521e+02, 9.69849359e+01, -1.46650002e+02, 1.43746448e+02, -3.58096154e+01, 6.59425776e+01, -7.21849145e+01, -6.87539755e+01, 1.66432359e+02, -1.40623516e+02, -1.18734164e+02, 1.55052005e+02, -4.82764708e+01, 5.59323907e+01, -1.54178276e+02, 1.67427130e+02, -1.18354983e+02, 1.59468545e+02, -5.88260066e+01, -9.01140431e+01, 2.24868741e+01, -7.59081408e+01, 4.43583880e+01, 1.55587240e+02, 1.29807227e+02, -1.49718166e+02, -1.19948514e+02, 1.40357839e+02, 1.44213902e+02, -1.44062711e+02, -1.29817873e+02, 3.49984181e+01, -9.63622895e+01, -1.24926915e+01, -1.11000760e+02, -3.43741568e+01, 1.48797532e+02, 1.88835865e+01, -1.73544133e+02, 6.03325573e+01, -1.57990772e+02, -5.17098103e+01, -2.60755388e+01, 8.25078483e-01, 7.48956391e+01, 1.74252874e+02, 5.38918097e+01, 1.54974969e+02, -1.04794479e+02, 8.59027201e+01, -9.52592930e+01, 2.70323439e+01, -1.22095479e+02, 2.17008307e+01, -1.43227328e+02, -1.78976733e+02, -3.24042762e+01, 1.61948946e+02, -8.36301770e+01, -1.34984212e+02, 4.39681183e+01, 8.67357348e+01, -5.73580167e+01, 1.22865680e+02, -8.48851950e+01, -1.64593330e+02, 1.05478712e+02, -1.69905335e+02, -1.50601265e+02, 5.27571208e+00, 9.82413223e+01, 3.83396295e+01, 1.30970779e+01, -5.09106881e+01, -3.63590540e+01, -1.47461904e+02, 6.23025696e+01, 1.10497599e+02, 5.39082643e+01, -1.45927282e+02, 1.02867120e+02, 5.98524223e+01, -1.26841963e+02, 6.45494266e+01, -6.97985875e+00, -1.72881161e+02, -3.87319768e+01, -1.45044479e+02, -3.27700139e+01, -3.74154558e+01, 1.20011832e+02, 1.09954787e+02, 5.25161296e+01, 1.01203373e+02, 1.72608059e+02, -8.41625117e+01, -1.64137738e+02, -2.63405188e+01, -5.01722370e+01, -1.28820266e+02, -1.56078425e+01, 1.52674414e+02, 1.28209538e+02, -3.38620042e+01, 5.91924320e+01, -5.69731548e+00, -1.41622700e+02, 5.43410000e+01, -1.07855271e+02, 1.26760658e+02, -1.23386480e+02, 2.95170826e+01, -6.47272144e+01, -1.69797717e+02, -1.25639380e+02, -2.95484818e+01, 1.47468574e+02, -1.15963512e+01, -8.43755817e+00, -1.35189939e+02, 1.21851829e+02, -1.72648672e+02, 1.38458709e+02, 1.34586857e+02, 4.31298876e+01, 9.84191964e+01, 7.15906736e+01, -1.39245970e+02, -1.43236364e+02, 2.75710773e+00, 1.35380946e+02, -3.13727305e+01, -1.37917095e+02, 2.33408568e+01, -1.38845669e+02, 1.45553925e+02, -1.52410824e+02, -5.40639398e+01, -1.12287354e+02, -1.34678921e+02, -1.16188483e+02, -1.59488400e+02, 1.04771460e+02, -4.54803045e+01, 4.38552033e+01, -1.17138135e+02, -1.27688222e+02, 1.20037870e+02, -5.33748860e+01])

In the above:

  • latitude and local_time coordinates have been computed as requested.

  • The intermediate results local_datetime and longitude were preserved as attributes (use keep_intermediate=False to drop them).

  • The location and datetime coordinates (which have been consumed by the transformation) have been converted to attributes (use keep_inputs=False to drop them).

  • The datetime dimension has been consumed by the local_time coordinate and thus renamed to local_time (use rename_dims=False to disable).

Post-processing

In some cases the above result may be all we need. Frequently however, we may need to resample or bin our data after this coordinate transformation.

In the above case, local_time is now a 2-D coordinate, and the coordinate is not ordered since the “date” component of the datetime has been removed. We may thus want to bin this data into latitude/local_time bins. Here we first use flatten with a dummy dimension to make the data suitable for sc.bin:

[14]:
time_edges = sc.linspace(dim='local_time',
                         unit='s',
                         start=0,
                         stop=24 * 60 * 60,
                         num=6)
latitude = sc.linspace(dim='latitude', unit='deg', start=-90, stop=90, num=13)
binned = sc.bin(transformed.flatten(to='dummy'), edges=[latitude, time_edges])

The result looks as follows. If this was real data (the sample data is fake!) we might observe that there are more lightning strikes on the northern hemisphere as well as later in the day. This might be attributed to more thunderstorms after hot summer days. Note that this example does not represent reality and is merely meant to illustrate several concepts of transform_coords:

[15]:
binned.plot(resolution={'y': 36, 'x': 24})