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]:

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]:


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]:

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 lattitude. To obtain this, we must:

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

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

3. Extract the time from the local datetime.

For this purpose, we may define functions that looks as follows. We suggest to the ignore 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 {'lattitude': 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',
'lattitude',
): lat_long,
'local_time': time,
'local_datetime': local_datetime
}
sc.show_graph(graph, size='6')

[8]:


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(
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]:

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
[ 4088.71516509 -477.5651836 -4862.5076652 ], [ 1690.9800489 -6034.79700305 1145.1867124 ], ..., [ 3870.67198774 587.27909136 -5026.19564205], [ 1855.02716919 3855.68850286 -4720.40055191]
Values:array([[ 4088.71516509,  -477.5651836 , -4862.5076652 ],
[ 1690.9800489 , -6034.79700305,  1145.1867124 ],
[ 4269.98767863,  2699.53870683,  3881.92439322],
...,
[ 2551.24480219,  2865.10524564,  5086.44894702],
[ 3870.67198774,   587.27909136, -5026.19564205],
[ 1855.02716919,  3855.68850286, -4720.40055191]])
• (location, datetime)
float64
counts
0.96, 0.55, ..., 0.95, 1.44
Values:array([[0.95612743, 0.55272498, 0.7231651 , ..., 0.97943442, 0.28663762,
0.25076907],
[3.57378026, 3.59715028, 3.28625062, ..., 5.17634524, 4.04934939,
3.84991641],
[3.07207802, 3.09085863, 4.0073907 , ..., 2.63251963, 2.67516939,
3.21407576],
...,
[2.718927  , 3.81919183, 4.24757755, ..., 2.90954032, 2.76810357,
3.3142897 ],
[0.46248205, 0.91394212, 0.79065162, ..., 0.83074209, 0.91832889,
0.02891735],
[1.8867483 , 2.2959091 , 2.60166593, ..., 0.76445914, 0.95173635,
1.43648342]])

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(['lattitude', 'local_time'], graph=graph)


The result is:

[13]:

transformed

[13]:

scipp.DataArray (1.69 MB)
• location: 1000
• local_time: 72
• lattitude
(location)
float64
deg
-49.75, 10.36, ..., -52.08, -47.81
Values:array([-49.74935418,  10.35519344,  37.53974594,  42.15728785,
22.31299631, -32.9342227 ,  37.0069744 ,  13.11481276,
-15.71260534,  16.97622607,   1.70299546,  50.1929277 ,
37.53589145,  69.15757015, -25.84571215, -44.347766  ,
-32.46035612, -14.82340816, -35.39397073, -26.25471934,
39.33514807, -71.44101723, -38.55103228, -28.11973028,
40.54209795, -24.08398171,  15.82013571, -29.0288083 ,
-21.80363382,  43.90630654,  46.80693235, -29.10045765,
-40.89695922,  27.15194421, -23.42527817,  76.44755148,
31.85786679,  16.68012923,  21.1399971 , -74.26706049,
22.0766706 , -65.38457863, -48.06370285, -57.01814221,
-33.1731508 , -32.03755481, -41.22554958, -66.43098079,
51.84748338,  52.55202661,  55.8514395 ,  51.56083197,
-29.113799  ,  58.89069647,  46.06124785,  11.23067074,
3.92645366, -30.75275455, -16.56281282, -35.59493967,
40.14020443,  19.28611486, -11.9998417 , -30.15489456,
9.50002057, -26.39503083,  56.82537234, -69.2944301 ,
-27.9387113 , -35.10176418, -36.13220364,  46.3329356 ,
-44.61836431, -30.76399776,  34.35567638, -48.78153976,
-29.27219958, -36.4573959 , -53.50142407, -32.40783623,
24.36956845,  51.16558931,  41.10589719,  27.44506376,
21.84624115, -39.61734331, -17.85908146,  43.01946036,
-50.25646131, -20.16895579,  42.34842031,  -9.22927734,
0.75297623, -23.03429775, -38.70871674,  57.20693777,
-24.07398951,  35.6219359 ,  54.37946844, -42.66664067,
42.09381241, -46.62477014, -11.7239958 ,  18.9719123 ,
19.96327776, -76.28916903,  50.11387044, -42.45647397,
18.2970912 ,  11.88838952, -56.66690179,  32.87992003,
29.23296446,  53.12446069,  15.12304695, -44.7445476 ,
17.89503942, -51.12578496,  10.97810302, -50.75980655,
-48.84091067, -27.23694469,  55.76927064, -14.43198068,
54.85227449,  53.37795428, -48.7111419 ,  -8.91493494,
87.01184976,  16.36090977,  59.75630084,  53.12754005,
17.81106255, -35.21576898, -12.19007309,  62.93419184,
-57.53509423, -48.67616658,  -8.85176169,  11.09705563,
-26.9664622 ,   1.46788559,  38.01429748,  10.39305867,
-21.26085147,  15.24785166, -16.94762519, -19.25727711,
21.20053724,  12.81913946, -50.2687445 ,  -9.82814776,
-9.55520722,  30.19923744, -22.31503041,  32.76593071,
-44.02418823,  11.35585278, -57.73228615,  -6.84774215,
-13.21772778, -13.81136064, -45.42976477,  25.05488004,
-45.05683978, -15.79542983, -65.60241914,  20.5253801 ,
-47.2144323 ,  50.6075896 ,  19.40859507, -27.3080613 ,
28.10609572, -51.89238068, -25.96711154,  23.70262474,
70.50240987,  36.90015973,  24.54205089, -56.04451585,
-45.77600409,  23.76933989,  -0.11203013,  63.41813046,
45.44885228, -40.88113276, -23.1905181 , -16.16547404,
-15.03701979, -54.31114221, -36.68001738,  28.56769871,
6.49131982, -32.56104322, -55.52222971,  44.08795833,
37.46314509, -66.15316769,   0.37371613,  22.13675924,
34.02769421,  62.42925905, -59.94445424, -50.05776663,
53.94895425, -71.82313029, -51.34922539, -36.07910962,
-42.53695555,  29.30739208,  42.49003352,  -4.30247727,
31.24248961,  -5.65708324, -33.76476434,  37.28747754,
35.42347448,  41.98621421,  43.33293387,  29.76952874,
-41.82553561,  48.14905086, -53.74972627,  28.18724202,
11.37993684,  -0.24185586,   9.32752191,  47.66335927,
3.86825555,  34.54953942,   1.38388745,  37.51186955,
-42.18877321,  26.39469736, -39.82182606,  27.17346978,
-41.81830606,  57.67161124,  49.88562476, -26.59767685,
-9.47734427,  26.34755111, -45.77834591, -23.83058238,
31.47820369, -38.12602022,  15.51273061,  32.74063047,
-43.7042829 , -22.35559973,  45.87091389, -21.19514535,
-33.16360327, -42.71050202, -22.33773156,  51.05668889,
-25.09318892, -14.27442407, -29.90632942, -38.97975912,
-55.53154213,  41.15376192,  74.4040016 , -20.29680929,
-25.04018142,  18.78497713,  52.33114849,  52.71303232,
42.81918206, -28.30149504,   6.87274236,  22.3945966 ,
36.77920001,   2.3305138 , -29.12434173,  14.7173799 ,
-67.44131472,  27.25698496,  42.038672  ,  32.27983466,
-48.16479847, -30.37039681,  59.41289486,  23.00401652,
44.75933365,  37.6937492 ,  -1.97037828, -70.23964498,
61.51153138, -22.0030025 ,  29.74277845, -44.93441883,
-19.74239408,  13.35539248,  34.63689329,  42.91500453,
-46.81928483, -16.48649535, -10.04317348, -43.86468989,
13.7568907 ,  30.64715557,  31.01831011,  26.68560616,
30.76725472,  57.62984725, -51.0386622 ,  34.9972069 ,
-9.47851268,  -0.83844851, -14.09722845,  21.47589618,
44.24012482,  25.01325636,  54.38358577,  40.14055809,
-38.66425219,  46.18860575,  29.97101354, -35.28587829,
-3.06303055,  21.17609465, -47.88172127,  22.44361945,
42.19526235,  25.32403629, -42.02156651,  45.30232665,
-33.60290274,  -0.46098833,  14.76525776,  17.12947897,
51.50131435,  28.29561306,   7.61357039,  61.2557732 ,
-27.97061672, -10.49810674,  24.61067443,  15.39703265,
-30.45316563,   4.71577214,  35.99188326,  42.39884391,
44.93599331,  10.45511787,  16.31728953, -32.32700809,
-52.92898949, -43.40132803, -43.81605508,  24.64641601,
-4.9072664 , -42.12158287, -24.35186492, -41.51116885,
-40.41147678,  35.546845  , -47.9876883 ,   5.40305588,
-37.10500471, -47.82319722,   1.78876126,  27.78025672,
27.09194319,  35.33091317, -52.40075307, -17.29897936,
61.86198554, -14.70656804,   1.6587332 ,  44.72060656,
33.63949839, -32.76441883,  -2.272649  , -38.62151385,
9.14640539, -17.69638292,  42.59065428,  27.09446818,
46.29698158,  37.74548091,  69.61119264,  13.97505557,
6.56379051,  76.28466779,   4.31264339, -48.16599994,
-5.78471382,  30.81803827,  36.68232697,  -6.28896439,
1.19549374, -12.27215947,  44.53456931, -34.22326163,
1.12255714, -33.92142248,  41.46949089,  26.16774626,
3.24578367,  -3.66691909,  35.15962552, -44.6307994 ,
45.47604359,  45.01741102, -52.48217538,  35.85255702,
-6.11450987,   7.89325803, -32.47702213,   3.57163374,
-56.45795139, -44.97870991,  36.33148323,  -6.78531514,
50.80087778, -13.04748946,  20.87466867,  40.96460444,
-0.83183489,  32.92228035,  -6.37158478,  44.48194703,
19.85306992, -47.16783095,  85.08814586, -37.03612912,
-34.88769663,  71.24716857,  19.95720186, -20.98311238,
-38.18850103, -23.00042301,  16.18108366,  31.97670565,
-71.93261984,  24.40137303, -38.15564091, -16.43088706,
41.97476342, -46.63399391, -24.95040706, -66.53349622,
47.16382315,  61.19782576,  22.84499122,  74.80849018,
-57.34701825, -18.58928038, -44.70396424,  32.32933025,
12.14442048, -21.72788231, -17.35906793, -58.14671695,
7.16023804, -34.08960991, -31.88303263,  46.21534236,
40.94767906, -40.37476546,   6.58025995,  41.88270103,
33.91636054, -11.7022867 , -47.16940049,  40.19576433,
17.41476056, -37.79311384, -49.74373833,   5.21972459,
-0.6736193 , -14.1001781 , -30.59561379,  -0.57186383,
-5.70906049, -32.61139139,  43.27322849,  31.19134788,
11.5645265 , -25.10859107,   7.09749076, -22.56392314,
9.06222054,  34.00862339,  35.91910201, -25.63025171,
53.98129107,  45.82527897, -32.74400644, -14.73374891,
20.34021849,  -0.19450234,  33.06818094, -21.13023248,
-59.00572677,  49.34954266,  36.30544513,  15.43452877,
-3.1805013 , -37.71318295,  33.2490964 ,  47.57557078,
11.52469638,  23.68636319,  57.66879794, -33.83896605,
-63.28248383,  57.44003559, -22.89865095,  36.25017934,
-36.12278014,   3.47825048,  -9.03769566, -53.67728659,
18.7437137 ,  43.57943724, -43.95601666,  27.42364555,
52.35396687,  79.19682354, -47.67505828, -32.80960574,
-17.60129527,  34.51286302,  26.33303834,  20.69546099,
-21.91236903, -26.24545689, -48.71431438, -62.53617212,
45.76962989, -47.9198318 ,  -8.4774205 ,  58.17014527,
-53.06706086, -14.52460196,  16.98516553,  41.50738701,
18.8001477 ,  34.66691129, -10.28421539,  -2.31336984,
42.31243767,  35.24014201,  -4.2352218 ,   7.87678784,
-47.94200571, -57.46958041, -40.83528468,  41.56202026,
-42.84932071, -53.32139908, -15.15864862, -28.02984507,
-65.29007086,  -6.3358607 ,  42.24520862,  29.03511451,
49.04178154,  42.96363233, -44.92146201, -18.41550016,
76.52616927, -12.05328749, -54.56999992,  41.02006851,
20.75821085,  31.32934948,  35.15960012, -48.0969076 ,
-33.99270177,  34.39698318,  79.39074715,  45.52257522,
35.55193784, -29.96235953,  36.75123388,   4.53160717,
-54.42861964, -76.3712035 , -22.07733202, -14.48164785,
36.03649459, -17.56725185, -19.09875272,  17.46727632,
30.77537741, -39.44933839, -34.46704852, -76.87181102,
-22.6393424 ,   1.25567287, -25.56476024,  49.47359132,
-6.80741251, -42.15418892,  15.38908187, -39.11969933,
64.18036748,   1.99120904,   1.40987339,  14.2915916 ,
41.78780623,  75.88194935,  13.46621357,   8.07800501,
4.3323437 ,  -4.87711646,  -5.31623288, -50.55773809,
-24.74281807,  38.41682583,  21.78553606,  28.03589249,
11.3931226 , -37.82252415,  31.97819456, -23.52447698,
21.70151172,   1.4645276 , -10.35016746, -75.67916508,
-20.71221344,  12.44435124, -78.67614723, -46.66372236,
16.29649598,  43.77998901, -54.56022372, -38.06902898,
-52.02255467,  -1.81785617,  14.55529763, -50.96421109,
51.75843553, -54.39072286,   1.50250088,  -9.89042982,
46.79630749, -35.67229116,  23.10388157, -56.3475273 ,
8.95453227, -41.55603975,  -8.969739  ,  46.73078363,
-40.92335141,   2.12764518, -25.62305579, -50.90324761,
6.55670285,  -7.66281668,  28.46490644, -16.38629949,
-43.57430408,  -4.96875775, -52.43084436,  52.72652001,
60.82442979, -32.1307132 , -11.97534295,  35.23447843,
-49.90015757,  -1.81688844,  44.53484919, -42.99555743,
64.7213618 ,  33.56757706, -32.08882516,  41.06941493,
52.22265993,   5.83734694, -25.14630494, -49.73413467,
62.56637368,  -4.58927349, -30.12559861,  25.4405729 ,
52.08421096, -30.8216568 , -42.09606803, -37.02226339,
2.97976757, -10.9697057 ,  24.39484483,  49.19853962,
25.45288366,  79.07912049,   3.82727497,  26.33818545,
-25.03628581, -30.61177932, -38.42038355,  27.68421188,
51.12822529,   2.07195467,  51.50375733,   6.13380502,
-43.99997525, -27.92490497, -48.85276161,  -8.94668244,
-22.62487659,  -0.67147219,  43.63840538, -14.57055727,
-57.87883076, -44.54660131,   1.82225666, -47.46957317,
-10.29623369,  30.70257832,  15.61810442,  -7.76446889,
-36.14796347,  -6.50170036,  14.71507908, -43.68425008,
33.50115624, -24.66398921,  27.88874457, -15.07821927,
-41.5928163 ,   6.89173077, -15.67283575,  88.47857154,
-23.21366741, -26.79377664,  55.8015486 ,  -0.36221295,
4.93123135,   2.35511492, -78.86956016, -47.79064178,
32.79715718, -56.84756222,  38.90121507, -24.99467773,
-28.89827939,   8.27108816,  44.67999383,  50.63489373,
-14.58015735, -46.27044351, -35.96563611,  42.48079935,
6.72811   ,  29.6211532 ,  10.40003287, -38.19145185,
-41.77425866,  26.13294486, -12.623629  ,  -3.19614552,
13.17708807,  -6.67103838,  26.89267149,  -7.53809525,
53.2788267 , -27.12464448,  -3.04612794, -50.12728446,
22.52284695,  43.10523133,  30.29482464,  -2.75662989,
-52.66197447,  52.01448795, -44.55214812,  18.11167181,
7.05626846,  21.40395963,  -9.59561926, -44.76347941,
45.4748914 ,  22.68880807,  26.66880573, -53.12066727,
31.05020143,  61.81722414,  40.3558223 , -50.75253094,
-16.65782088, -31.82770416, -30.39911061,  19.9083063 ,
1.21215746, -74.76842229, -22.67123171,  -0.45426322,
-27.45624982,  34.89882184, -16.43152881, -24.20510016,
43.81179471, -37.57818696, -12.79739807,   1.73465383,
3.06057972,  -8.00426417, -29.7206113 ,  13.82011948,
45.17626796, -40.86825203,  38.98226233, -21.23471351,
-42.80288695,  45.86152099, -60.65150787,  41.89340549,
34.74490092,  23.60957239,  55.06882844,  47.68108018,
-2.20017713,  69.71592851,  66.1200934 , -50.21182511,
-8.55745339, -57.02751443,  60.9050095 ,  52.30659159,
-36.33604237,  49.9745935 , -15.31836029,  37.50426815,
47.72438167,  40.02804013,   4.2855765 , -18.38844661,
-35.96203872, -32.27787801,  46.25053519,  54.7386156 ,
-10.57904151,   9.82038451,  53.14621149,  43.16890739,
87.97527989,  31.63808522,  38.21529391,  18.29075278,
9.27744476,   2.00457797, -46.71538661,  55.69149681,
-50.59529688, -41.95886086,  35.82490673, -70.79639006,
-11.29976984,  45.41684505,  53.7746108 , -24.10914717,
26.33921492,  26.1232306 ,  -3.0941886 , -42.35805371,
16.47209784, -30.71947084,  20.95469205,  69.04643036,
57.76902511, -22.03729456,  -9.75288622,  -2.92194625,
51.72543438, -47.90729834, -37.79193637,  46.83071768,
-45.2035391 , -45.91858638,  65.39552536, -19.19335856,
-23.96266478,  18.39957863,  39.32734661,   1.73510282,
-21.15279428,   6.91271197, -56.39738806, -85.85607028,
26.06857422,  -0.90873528, -30.76611072,  26.39182186,
14.64395123,   7.21827982, -41.11240196, -31.36493401,
14.91599143,   4.03535919, -13.85343053,  27.47876981,
-21.67744467,  37.92365546,  66.57211709, -56.25110364,
24.4226455 , -12.6644228 ,   1.94105196, -52.99196597,
-84.69713535,  62.82296156, -12.64251123,  35.06344345,
-28.93267829,  26.82147093, -30.31331565,  35.33378264,
14.25662685,  34.61841367,  -0.84887906,  45.41362604,
-10.67974968,  -5.95419961,  77.24936168, -42.96583623,
11.55971532, -34.17731492,  49.47253437,  28.77682347,
-39.08577227, -34.93164122, -51.77992226,  10.73327137,
-18.55682951,  38.38123442,   3.1476499 , -34.25485686,
42.45615055,  20.20486469, -44.27406133, -38.88664404,
-19.54071063, -54.3201725 , -30.47777009,   9.94144206,
-57.92623548,  53.70270152, -42.40146542,  26.18780711,
-10.7487117 ,  47.80325591, -23.04148192,  20.20290452,
42.86973807, -80.10737935,  56.55232562, -64.26325011,
-20.89026925,  41.87206589,  10.14313574,  50.62943276,
-29.95411395,  33.82494705, -51.73092939,  45.21827649,
41.1405184 , -62.26246606,  26.19964683, -68.54813754,
-58.67458658, -40.96597154,   3.67784   , -17.12317071,
-42.24450731, -10.86950497, -59.50150535,  72.79978956,
44.34125569, -38.42691382,  23.1632139 , -47.39784441,
-17.15413789,  -8.99345916, -30.09266831, -56.30916431,
47.46163991,  -7.8857626 ,  53.30760385,  12.83447486,
-6.79758204,  41.46454853,  36.39378334,   6.95015743,
48.63821762,  51.27951824,  61.18040971, -42.99785377,
1.87553507, -56.72447616,  23.88791709,  33.07175163,
24.43977494,  52.97523248, -52.08449788, -47.80983424])
• local_time
(location, local_time)
float64
s
18000.0, 21600.0, ..., 25200.0, 28800.0
Values:array([[18000., 21600., 25200., ...,  7200., 10800., 14400.],
[ 3600.,  7200., 10800., ..., 79200., 82800.,     0.],
[25200., 28800., 32400., ..., 14400., 18000., 21600.],
...,
[28800., 32400., 36000., ..., 18000., 21600., 25200.],
[18000., 21600., 25200., ...,  7200., 10800., 14400.],
[32400., 36000., 39600., ..., 21600., 25200., 28800.]])
• (location, local_time)
float64
counts
0.96, 0.55, ..., 0.95, 1.44
Values:array([[0.95612743, 0.55272498, 0.7231651 , ..., 0.97943442, 0.28663762,
0.25076907],
[3.57378026, 3.59715028, 3.28625062, ..., 5.17634524, 4.04934939,
3.84991641],
[3.07207802, 3.09085863, 4.0073907 , ..., 2.63251963, 2.67516939,
3.21407576],
...,
[2.718927  , 3.81919183, 4.24757755, ..., 2.90954032, 2.76810357,
3.3142897 ],
[0.46248205, 0.91394212, 0.79065162, ..., 0.83074209, 0.91832889,
0.02891735],
[1.8867483 , 2.2959091 , 2.60166593, ..., 0.76445914, 0.95173635,
1.43648342]])
• 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-02T05:00:00, 2021-06-02T06:00:00, ..., 2021-06-05T07:00:00, 2021-06-05T08:00:00
Values:array([['2021-06-02T05:00:00', '2021-06-02T06:00:00',
'2021-06-02T07:00:00', ..., '2021-06-05T02:00:00',
'2021-06-05T03:00:00', '2021-06-05T04:00:00'],
['2021-06-02T01:00:00', '2021-06-02T02:00:00',
'2021-06-02T03:00:00', ..., '2021-06-04T22:00:00',
'2021-06-04T23:00:00', '2021-06-05T00:00:00'],
['2021-06-02T07:00:00', '2021-06-02T08:00:00',
'2021-06-02T09:00:00', ..., '2021-06-05T04:00:00',
'2021-06-05T05:00:00', '2021-06-05T06:00:00'],
...,
['2021-06-02T08:00:00', '2021-06-02T09:00:00',
'2021-06-02T10:00:00', ..., '2021-06-05T05:00:00',
'2021-06-05T06:00:00', '2021-06-05T07:00:00'],
['2021-06-02T05:00:00', '2021-06-02T06:00:00',
'2021-06-02T07:00:00', ..., '2021-06-05T02:00:00',
'2021-06-05T03:00:00', '2021-06-05T04:00:00'],
['2021-06-02T09:00:00', '2021-06-02T10:00:00',
'2021-06-02T11:00:00', ..., '2021-06-05T06:00:00',
'2021-06-05T07:00:00', '2021-06-05T08:00:00']],
dtype='datetime64[s]')
• location
(location)
vector_3_float64
km
[ 4088.71516509 -477.5651836 -4862.5076652 ], [ 1690.9800489 -6034.79700305 1145.1867124 ], ..., [ 3870.67198774 587.27909136 -5026.19564205], [ 1855.02716919 3855.68850286 -4720.40055191]
Values:array([[ 4088.71516509,  -477.5651836 , -4862.5076652 ],
[ 1690.9800489 , -6034.79700305,  1145.1867124 ],
[ 4269.98767863,  2699.53870683,  3881.92439322],
...,
[ 2551.24480219,  2865.10524564,  5086.44894702],
[ 3870.67198774,   587.27909136, -5026.19564205],
[ 1855.02716919,  3855.68850286, -4720.40055191]])
• longitude
(location)
float64
deg
-6.66, -74.35, ..., 8.63, 64.31
Values:array([  -6.66200674,  -74.34686456,   32.3015775 ,   51.2536952 ,
145.56096581,   22.3324044 ,  -57.62936176,   96.29684609,
76.74478261,   87.14747448,  -77.43912099,  -53.72306677,
115.67324874, -132.29120592,  -25.08364819,  -47.67378321,
49.25089027,  -65.70207148,   -2.1828731 ,  109.87350529,
125.63503011,  -55.8532638 ,  -38.38271258,  -38.67818448,
143.75761586,  -13.52888258,  125.83647634,  116.77876339,
122.78516766,  -78.69958301, -154.74467469,   38.46626768,
102.89534657,   13.53114365,  -77.93907829, -108.69535798,
27.84022966,  -22.3914655 ,   72.38133159,  -64.00564879,
71.71804893,  133.24733701, -134.20232058,   26.58479068,
-54.32448252, -159.34234038,   65.04931141,    1.53830502,
-173.16777321,   97.8583051 , -139.53380203,  -65.68378564,
-155.55376525,  124.12086159,  121.9211396 ,  -17.91282296,
-173.94052557,  132.12979628,   -0.59926665, -115.63875541,
-46.03588969,  -50.38830207,   77.97692914, -143.18756655,
148.87200485,   98.96874792,  135.42538888,   24.20906404,
128.69729744, -129.95120412,   27.41404292,  146.78736517,
-148.43428588, -131.61901591,  -55.51413167, -178.96588302,
153.5242062 ,  163.87368728,  -24.93947038,  133.16628052,
37.72708029,  172.36420864,  128.07333486,   56.71043304,
23.05151068,   78.55945769,  168.13593936,  -11.36932745,
-175.48682108, -158.78320691, -126.20339634,  -87.65444779,
68.33693867,  -49.77549756, -128.67655804,   73.20229696,
164.23617775,  -94.09077707,  -66.93488454,  -53.67299306,
-60.94570479, -103.01593511,  -40.03359155, -108.87479779,
93.08479271, -134.90535149, -152.79567804,  156.8104335 ,
-136.09533855, -176.22129545,  106.55477567,   44.09377597,
-95.22163466,   93.66887229,   94.56814432,  -54.52774664,
-64.734964  ,  -90.41371973,  -52.33716908,  -99.22410581,
92.23780412,   45.76917362,  -24.02376126,  116.91013354,
35.04469253,  -71.80107681,    3.88910361, -126.34625037,
9.09891717, -110.92248563,  100.59873485,   33.86379274,
170.39638197,  160.47549035, -145.68468035, -114.70850598,
-110.62008082,  -26.15915581,   52.91064519,   46.05775373,
-73.94538004,  -24.02348811, -176.36360366,  -90.28233214,
-99.39623414, -128.61342838,   58.5466668 , -121.24836247,
144.82142462, -137.27951762,  177.60978725,  -76.88035382,
48.26576237,   24.98346559,  -77.59913835, -173.59654744,
46.75041177, -122.61617802,  106.21740073, -136.52155169,
130.14519956,  140.11142393,   63.91050082,   49.62315073,
-113.32512015,   98.10075268,  -74.55626749,  -79.53255801,
167.57523609, -113.52525666,  -51.28590649,  -49.38614458,
-36.52372243, -164.1736847 ,   62.2365287 ,   88.26384397,
143.83319088,  -85.88152124,   34.31486264,  165.76161754,
-78.44501853, -120.70751675,   83.63023137,   13.75815285,
-75.5260839 ,  134.09377583,   12.42838979, -111.50736358,
44.23760296,  -88.29616006,   50.84181282,  147.5721436 ,
139.29884734, -146.70233368,  -33.05906494, -168.2043017 ,
49.89713069,  -74.53086334,   42.29804386,   53.36986731,
133.90106547, -143.70298079, -148.68536357,  125.91890979,
-114.76236039, -120.85570138,  133.86241016, -142.58395662,
-165.50896959,   53.80922981, -152.17487448,   31.18713842,
41.80633107,   36.13948212,   89.30765621, -141.61848393,
147.04153745,  141.46467537,   39.0494263 , -131.87883767,
119.67527803,  -57.81700767, -142.5145444 ,   -2.41119871,
54.94122941,  141.1675115 ,  145.83301077,  101.18374975,
120.9071729 ,   51.36989556,   35.52070381,   95.54925224,
-93.32982484,  147.3641476 ,   63.52328843, -128.76075715,
-111.08899698, -117.3971273 ,   68.7900749 ,  -79.72092976,
50.37309988,  -51.18317349,   60.0488631 ,  130.23463291,
-171.90607935, -105.13791808,  171.46106517,  143.83992444,
134.1554296 ,  -96.40525875,   75.52370314,  -63.17042347,
-143.9678348 ,  -33.79459005,   -3.0206428 ,  -87.82541853,
45.05282429, -103.93898331,   37.41180898,   88.3978946 ,
-86.04345798,   35.33548775,  129.93118439,  128.34745395,
5.05624092,  110.67474422, -160.77403498, -100.14554787,
140.06976356, -156.86504188,  -50.12940211, -162.5527192 ,
-158.36905683,  114.85195257,   55.56154596,  -41.4252853 ,
23.0158115 ,   38.64304709,  -45.97063924, -125.98642155,
-28.87669083,  -59.46216906, -154.83670522,   -0.95314055,
81.18879277,  144.60293684,  -33.15894118,  167.33905464,
-109.46872471,  -98.35474739, -111.36030318,   37.19877593,
-131.45991634, -154.57513581,  -77.52301703,  -70.94854421,
155.76094527,    4.61110929,   12.97478202, -155.98615015,
71.73159911,  -38.06151462,  143.2747394 ,  -55.86270691,
85.01790764,  -14.06146887,  -58.49427559, -135.24483006,
9.42484652,  -13.74285719,  -59.18430613,  109.35024398,
-1.11687006,   74.05789283, -152.05777593,  -76.69133436,
-51.39779944,  -35.30986974,   43.29344066,  -87.97687755,
157.04345658, -118.38236989, -117.48061776,  151.10015073,
6.665888  ,  123.28857634,   32.75895212,  -63.99827781,
-69.01146591, -143.69869745,   53.31674187,  -20.88017148,
51.8248488 ,  -66.05490364,  -35.84967884, -172.83468598,
3.90040181,   32.88316404,   83.38180064,   -7.59344771,
139.80410618,  139.56970348,   94.0882455 ,   77.46300007,
123.15954925,   71.9707537 ,   68.49437843, -176.17214775,
4.08823424, -173.5705017 , -127.36039893,   97.33145482,
136.25754521,    9.05968347,   -3.30907575,  -29.30099626,
-45.33804376,  119.68054028,  -24.97112451,  -22.3567028 ,
-100.90735881,   98.90296171, -111.9540409 ,  152.74487088,
-141.64842297,   -1.58531262,   80.69345679,  137.42362334,
-157.14509191,   26.75443755,  -97.16639485,  112.47091497,
53.96853543,   15.3323676 ,   33.88769955,  -62.8313754 ,
48.1364794 , -152.61141743,   42.97412384,   -8.18705803,
-10.72543062,  -19.98226437,   38.35355682,  -36.33610036,
-87.09829822,  -31.70934861,   23.20812558,  145.14193651,
142.09151956,  -58.90683934,  -39.44501431,  118.52543372,
-20.9596108 ,   42.68222816,  -23.34398167, -179.47566143,
-57.3693202 ,  142.16881109, -120.75373933, -124.86219588,
127.05294688,  100.79562562,   27.33633931,   65.94799936,
104.25673447, -164.0751454 , -146.32407041, -106.25074608,
83.23083294, -135.38367856,    0.25053075,  150.06520438,
97.92328387,  176.98673831,  133.47076629,  131.45216049,
108.70253103,   49.07691746,   17.63824416, -124.44333114,
30.34829342,    5.30912791, -142.68682398,  -30.80952268,
118.43824728,  138.40890025,  172.03494042, -134.43670998,
-27.81509771,  111.21021847,   64.79433056,  110.4270712 ,
-161.56480584,  115.98165041,   76.89343493,   55.1961371 ,
158.83366683,  -18.44688652,   42.27728309,   51.23401643,
-120.79889903,   73.35109969,  -27.2459003 ,  150.220024  ,
90.80904124,   92.06065363,   20.5622035 ,  -89.51465065,
-87.64140968,  -99.86486281,  136.79282511, -155.5614196 ,
143.5356493 , -170.64252066, -134.44087094, -107.08698786,
-147.34013585,  114.4739023 ,  -43.93576544, -173.73078478,
29.08890617,   93.00295261,   99.70978827, -162.79221794,
35.58103831,   50.77426807,  -61.43930344,    0.6452725 ,
-48.7235978 , -168.42567852,  164.82305636, -132.98874489,
-18.57279057,   93.65371801,  132.80994155,  -10.2155022 ,
166.37718536,   21.97438277,   55.99222433, -137.40783399,
-4.05510485,   61.91958741,  -26.43375461,  161.37757677,
-111.89038393,   44.56620889, -132.66799318,  -60.84561681,
-95.53661456,   63.3866901 ,  -97.60275062,   88.62334502,
-101.15316246,   -2.82472222,   91.11844868,   34.20670214,
-1.59963154,   28.88578161,   70.39134256, -156.42816791,
-117.5415686 ,  168.73551678,  -75.77527316,  -17.14989767,
-57.98813015, -119.03630825,   14.72402329,  126.80342486,
145.88924999,   44.07604594,  176.54777341,   63.94646962,
67.97051142, -137.20996691,   40.18820431,   18.87208407,
-139.61031306,  -16.00843384,   45.38375033,   67.64550025,
79.33638205,   25.0620991 ,  -39.54737287,   85.82698598,
-38.34924686,  122.70347954,  160.77854398,  113.60632286,
111.72189639,  -78.09266514,  -77.14034307,  -62.65967514,
-35.16909033,  -79.62788971,   89.00898925, -104.78443053,
-66.78960686,   59.10474592,  -67.7994657 ,  -33.62392209,
-21.18827072,   66.41985593,   43.43244769,   18.89392354,
-60.41410837,  -46.47985086,  166.93368006, -122.86218181,
174.29128425,   66.02913229,  -69.84600861,  -85.23226577,
-98.25879925,  135.49827444,  -34.18484393,   67.32669595,
-143.48048376,   56.03121527, -131.08637261, -173.72666897,
45.852096  , -145.61848257,  134.65172315,  161.20288064,
98.55758606,   47.496358  ,   27.80852572, -178.87155725,
-35.74451067,  125.13695834,  -25.34488192,  -24.22408078,
134.48482667,   77.59172769,  -99.62851797, -155.76189279,
45.92129055,  117.20715371,  -34.10316762,  131.7443085 ,
-150.8649291 , -113.37312505, -133.13036485,   49.59772223,
-71.43109649,  -62.7275164 , -101.18924948,   21.49828461,
44.81030677,  146.7346116 ,  -53.98342634,  -34.26132823,
-12.19087765, -113.36429451,  -29.17649524,  128.63644296,
59.17557768, -117.80573582,  -10.04659644,   62.05139931,
-58.91031356,  125.67584837,  161.8630337 , -137.37753198,
-87.27745038,   21.76079231,  169.71351446,  -29.76451584,
170.09676908, -148.73171897,  -30.24945919,   56.3238964 ,
135.69550567,   14.53769948,  155.43582736,   48.3571484 ,
-131.52985121,  -27.01793259,   44.38604803,  -66.86071216,
91.83533895,  -32.88662507, -114.6461871 ,    7.32491112,
20.78535299,   29.8185056 ,   46.63650571,  -12.06708382,
-170.16313927,   68.59695168, -168.46972665, -164.77499098,
-45.22758577,  177.49388715,  -19.98168251,  111.87288219,
44.40570763, -134.76400534,  -82.28006552,   47.699534  ,
-80.53066911,  -12.86258505, -105.98420494,  171.95955774,
-101.86690638,   31.85670239,  -73.90315244,  -25.78167183,
-126.11985388,  131.33163768,   14.20226803,   12.07761499,
-117.08271536, -147.23520883,   34.5353886 ,  -51.94234938,
-0.62646479, -135.04305878,   19.71750914,   18.40818264,
2.5979945 ,  122.76555561,  -14.07713993,  -41.19581612,
-76.17283414, -114.23857809,   34.71403787, -121.39609934,
-85.16186155, -158.32816319,    6.10321845,  115.87053873,
61.35010065,  -28.21581085,  -98.39840859,  137.62344833,
137.90733078,  109.80238596, -160.38074458,  155.90312867,
27.10408751,   57.76634381,   92.30150404, -121.65234155,
-126.47744803,  111.03570181,  160.54831741,   -3.18585978,
71.18517403,  -19.13498175,   91.60209429,  127.98328941,
-42.76714406,  -64.14066673,   45.01987398,  156.8982961 ,
5.68395406, -121.92218582,  -73.77533346,   57.40351451,
94.02887778,   11.94486258,  141.51839029,  134.61326495,
-39.09965076,  134.17158787,  120.24991073,  -53.56772371,
143.28583099,   25.87944795, -116.76139282, -106.758685  ,
99.53201442,  169.98449098, -124.20471456,  136.91206069,
159.60822611,   25.38434619,  130.42480515,  146.64949005,
-10.53330307,  -10.2658576 , -129.123251  ,  102.32655694,
66.42379908,  -47.02180626, -126.30872283,   73.96762333,
-9.77806767,  -10.65565582,  174.37615227,    9.83068876,
23.1449597 ,   82.81761701,   20.32397918,  -19.82125246,
-138.73910464,   62.67932572,    8.80588893, -106.33285807,
49.43963671, -107.58777843,  -83.84235658,  155.1138522 ,
-17.31608057,   41.59476389,  -76.9662056 ,   57.57236612,
104.36292898,  -75.84541554,    5.01885079, -111.09880226,
174.75490605, -122.94186981,  137.75460231,   -4.54466584,
153.74730555,  125.82488086,   12.36234437, -123.82517235,
-103.16203271,   44.1850279 ,  133.38828009,   30.22722031,
-74.94726622,  106.67942553,   75.30462577, -136.42505574,
-84.63840734,  131.27305533,  133.78692512,  167.24933312,
47.12909675, -117.85908816,   48.09653566, -140.54759798,
-85.91587606, -121.52758316,   39.41050832,  141.64134793,
128.09124019,   97.93751297,  -73.84291019,  178.34909972,
-24.04675742, -109.05181754,  179.88365886,   57.95599559,
-155.36158718, -118.1731018 , -170.43775672, -146.05389644,
-50.06014119, -135.71771891,  -17.43516992,  134.88930051,
146.2609428 ,  134.47460728,  142.95615097,  -87.12979959,
179.09508902,  -29.40610333, -137.54922038,   73.45641672,
168.70032491,  -53.20497994,  -90.24289206,  -85.23371799,
140.23854499,  -80.49222356,   39.25726318, -102.84256603,
58.94859784,  -61.14180453,   22.16916274,   26.36177131,
84.15012273,  -63.83037394, -136.15937394,  167.90766927,
165.4793215 ,   36.21987804,   85.56110058,  -85.64105706,
-171.84504248, -134.39442832,   52.77118994, -120.46955823,
172.99746113,  179.41342896,  -12.45245834,  155.79548006,
-150.99912265,  -52.54703556,  110.19668582,  103.00642337,
-135.80208528,  -74.3815024 ,  -90.92202883,   66.20450401,
-94.20762085,  137.29831068,    3.31423396, -133.14353167,
28.35866722,  163.41604681,  -53.07727903,  142.11586288,
-66.36695611,   63.29863357,  -82.1273969 ,   70.84989531,
36.85956672,  -13.00152923, -107.47199053,  158.52897874,
69.36504507,   -7.6268613 , -131.74677783,  -81.11668548,
-67.45288484,  -39.05561913,   14.79299117, -159.49353013,
27.47102404,   45.37093835,  -60.04557219,  -30.05549221,
161.76892615, -140.8998351 , -148.74870502, -172.19867785,
-120.83360438,   29.09961643,   96.2157647 ,  139.51151592,
-0.43873234,  171.45204225,  -30.4600234 , -137.76762644,
162.71520855,   20.55727189,  111.41125901,   62.05265079,
-140.60616823,   62.2556473 ,  124.71856073,  -78.92254954,
104.03297794,   77.97513455,  127.16778598, -135.03748287,
138.52620234,   35.66856167,  -66.74298822,    4.00368052,
-141.77285652,   16.94136952,  -92.27737697,   50.5755918 ,
99.16950174,  126.83949974,   54.67226279, -174.49560369,
-71.54746446,  165.80141373,   75.73724227,  -98.18524549,
79.40952163,   -3.09685251,   38.52207108,  109.35714325,
56.65789796,  -20.27854108, -166.21719688,  116.10615696,
-86.16453312,  177.20124624,  -29.5709043 , -113.72290368,
26.13092397,  120.1777335 ,  -39.34008956,  -96.07408216,
150.55033753, -103.82335466,  -26.1765034 , -158.23876911,
-48.04457215,  -81.99908361,  -28.88307468,  154.86748045,
-93.30390668,  102.92782317, -156.25160785, -142.82128881,
-150.09476999,  164.16257215,  -68.0377941 ,  146.44137684,
108.89635258,  -19.26203639, -139.97626666,  138.72490756,
112.17163832,  164.39110592,  -46.32528432,  -78.40147172,
-160.53583513,  -23.96388935,    8.46154795,   33.55099679,
158.56857359, -169.32576539,  173.41624822, -131.6632206 ,
41.65646934,  136.00122212,  -46.72328732,  120.69613202,
45.68866913, -166.68088582,  -35.06947101,  -39.56417243,
-159.09209999, -117.83329646,  156.97584215,  122.66077184,
-97.68292772,   -5.6381246 ,  167.76211622,   90.41008913,
-157.09321656, -155.59241759,  -23.33156198,   97.24334905,
155.31693164,  -43.79075718,  176.68070154,   56.68134452,
-111.89887568,  139.67651475,    1.87002225,   60.22040255,
82.09786785,   32.75743575,  122.31992257,   48.51066668,
13.83549636, -179.63700786,  -39.02540573, -118.82952965,
138.10209681,  149.54444714,  -58.05482102, -128.09169057,
1.35376184,   48.31640149,    8.62742145,   64.30712381])

In the above:

• lattitude 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 lattitude/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)
lattitude = sc.linspace(dim='lattitude', unit='deg', start=-90, stop=90, num=13)
binned = sc.bin(transformed.flatten(to='dummy'), edges=[lattitude, 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})