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
import plopp as pp
x = sc.linspace(dim='x', unit='m', start=1.0, stop=55.0, num=100)
da = sc.DataArray(data=x * x, coords={'x': x})
da.plot(figsize=(4, 3))
[1]:
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]:
- x: 100
- x(x)float64m1.0, 1.545, ..., 54.455, 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)float64m^21.0, 2.388, ..., 2965.298, 3025.000
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)float64m^21.0, 2.388, ..., 2965.298, 3025.000
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))
[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.
Making coordinates unaligned 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]:
- x^2: 100
- x(x^2)float64m1.0, 1.545, ..., 54.455, 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^2(x^2)float64m^21.0, 2.388, ..., 2965.298, 3025.000
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)float64m^21.0, 2.388, ..., 2965.298, 3025.000
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])
Note how x is now unaligned (not shown in bold), 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:
Extract latitude and longitude information from the sensor locations.
Compute the local datetime from the datetime and a “timezone” offset from the longitude.
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')
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]:
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=[0.5, 0.5, 0.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},
)
north = location.fields.z > 0.0 * sc.Unit('km')
north.unit = sc.units.one
da += 2.0 * (north).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]:
- location: 1000
- datetime: 72
- datetime(datetime)datetime64s2021-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)vector3km[-5681.09549258 -207.59877736 2876.05593684], [2197.08004503 5965.51656095 -418.44048172], ..., [ 3923.22431629 2927.26677503 -4077.87459247], [ -132.11070946 3117.34714775 -5554.66781373]
Values:
array([[-5681.09549258, -207.59877736, 2876.05593684], [ 2197.08004503, 5965.51656095, -418.44048172], [-6246.71329892, 925.03876945, 844.10736051], ..., [ 1982.7347829 , 6051.97754339, 178.80602612], [ 3923.22431629, 2927.26677503, -4077.87459247], [ -132.11070946, 3117.34714775, -5554.66781373]])
- (location, datetime)float64counts6.190, 5.929, ..., 1.809, 2.244
Values:
array([[6.19033624, 5.92909402, 6.05922954, ..., 5.91971348, 6.9419554 , 6.05233451], [2.01299408, 2.41134858, 3.13658826, ..., 0.79976679, 0.98146891, 1.41957401], [6.7450953 , 6.482127 , 6.21134135, ..., 5.74106877, 6.56851058, 6.46532304], ..., [4.10879429, 4.38579154, 4.5993279 , ..., 3.26559588, 3.09482718, 4.11986245], [0.44725708, 1.4689661 , 1.33659516, ..., 0.66860974, 1.09997591, 0.42284013], [2.50747048, 3.07785673, 3.94903195, ..., 1.19749155, 1.80880926, 2.24393213]])
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]:
def scatter_plot(da):
from plopp import widgets as pw
da = da.copy(deep=False)
da.coords['x'] = da.coords['location'].fields.x
da.coords['y'] = da.coords['location'].fields.y
da.coords['z'] = da.coords['location'].fields.z
inp = pp.Node(da)
slider = pw.SliceWidget(da, dims=['datetime'])
slider_node = pp.widget_node(slider)
slice_node = pw.slice_dims(inp, slider_node)
fig = pp.scatter3dfigure(slice_node, x='x', y='y', z='z', pixel_size=500, cbar=True)
return pw.Box([fig, slider])
scatter_plot(da)
[11]:
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]:
- location: 1000
- local_time: 72
- datetime(local_time)datetime64s2021-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]') - latitude(location)float64deg26.835, -3.766, ..., -39.797, -60.676
Values:
array([ 2.68354220e+01, -3.76583644e+00, 7.61362681e+00, 3.57829744e+01, -1.72812436e+01, 2.82907028e+01, -3.50987994e+01, -4.62851010e+01, -3.65516559e+01, 5.14820469e+00, -1.82605687e+01, 3.61695217e+01, -2.25540006e+01, 4.53811091e+01, 2.05492192e+01, -3.60904371e+01, -9.51484680e+00, 5.25974001e+01, -1.52266868e+01, 8.36531686e+00, 3.03963750e+01, -4.14516682e+01, -5.91731627e+01, 5.98620441e+01, 5.01939369e+01, -8.22196152e+01, -5.18233786e+01, -2.57493112e+01, -5.72012138e+01, 3.86971063e+01, 3.44927894e+01, -4.89283630e+01, -5.85430431e+01, 5.91429116e+00, 4.43626022e+01, -3.05791305e+01, 8.86618488e+00, 4.81004483e+01, -4.08417568e+01, 3.56675940e+01, -2.56658282e+01, -3.37934239e+01, -1.58446656e+01, -6.92034722e+00, -2.44480994e+01, -3.18349503e+01, 4.36109371e+01, -4.22665297e+01, 2.45872726e+00, 6.63760918e+01, -3.37296697e+00, -2.45122544e+00, 3.77311618e+01, -1.17973495e+01, -5.29810592e+01, 2.87709216e+01, -1.57812344e+01, 3.99418510e+01, -5.78039644e+01, 4.67812403e+01, -4.62727211e+01, -5.34744308e-01, 1.17247753e+01, 3.71670481e+01, 1.62527748e+01, -4.56277458e+00, 1.62023269e+01, 4.16492240e-01, 1.24605950e+01, -2.11184258e+01, 4.55644350e+01, -3.89025148e+01, 4.24831569e+01, 5.47038083e+01, 5.39276945e+01, 2.56963463e+01, -4.80535186e+00, -3.24930497e+01, 4.12947877e+01, -7.68287028e+01, 2.46394993e+01, 4.56085869e+01, 4.05873188e+01, -4.66202795e+01, 4.68389458e+01, -1.64429250e+01, -3.95931630e+01, -5.07750941e+01, 3.37218976e+01, -3.75967650e+01, -5.76054128e+00, 3.30528095e+01, 4.29005012e+01, -2.45755398e+01, 6.31989997e+01, 3.65897019e+01, 4.28097672e+00, -7.10124679e+01, -1.37447700e+01, -4.40148957e+01, 3.66533306e+01, 1.88098375e+01, -3.46711502e+01, 6.23732532e+01, 4.63292654e+01, 1.82919808e+01, 2.85169042e+01, -4.22346218e+01, -7.86650629e+00, -3.99275897e+01, -4.69441928e+01, 2.72764595e+01, -5.22164431e+01, 4.35003867e+01, 5.24407245e+01, 7.55957396e+00, 2.66507814e+00, 4.08932596e+01, -2.62873251e+01, 5.24490303e+01, -3.95482772e+01, -1.60072799e+01, 6.53549722e+01, 3.05395526e+01, 1.99570615e+01, -4.57374457e+01, -3.43316561e+01, 1.83436560e+01, -4.70013835e+01, -1.82439312e+01, -4.29875999e+01, -1.54642627e-01, -8.44457466e+00, 8.25489564e+00, 1.27042027e+00, 4.63199982e+01, -2.43351234e+01, -1.88715195e+01, 3.65191069e+00, 1.92350295e+01, 6.07491715e+01, 2.14817457e+01, -2.43057551e+01, 6.99347122e+01, 2.06244958e+01, 3.44886679e+01, -3.18580008e+01, -4.08938446e+01, 4.22678506e+01, 6.17945498e+01, 3.93680953e+01, -3.22811844e+01, 5.61086166e+01, -3.46685615e+00, -3.34045058e+01, -2.34640623e+01, 4.50488475e+01, 2.60432330e+01, -5.44215428e+01, -7.98049122e+01, 2.15244887e+01, 2.32518635e+01, -4.67241647e+01, 2.75037596e+01, -2.60637048e+01, -3.08895963e+01, -5.55049179e+00, -3.27660328e+01, 6.21902564e+01, -3.15144670e+01, -4.54906534e+01, -4.01204900e+01, 4.26492990e+01, -2.24403823e+01, -3.14197521e+01, 2.01242979e+01, 1.32310894e+01, -7.91891569e+01, 1.55083002e+01, -3.74564136e-01, -4.82718560e+01, 1.29198310e+01, -1.38964465e+01, -3.45860992e+01, 5.03118729e+01, 2.67371738e+01, -3.89560301e+01, 1.86532810e+01, 2.55076760e+01, 4.79677103e+01, 5.94627004e+01, -1.88764718e+00, 2.74042876e+01, -3.96172001e+01, -1.69078250e+01, -1.98088598e+01, 4.58173477e+01, 2.51783911e+01, -4.58232435e+01, -2.42047347e+01, 7.29745893e+01, 4.88384022e+00, 1.81183732e+01, -5.80862517e+01, -2.39728900e+00, 5.98589016e+01, -3.75214174e+01, 4.86484788e+01, -5.53595184e+01, -3.32102276e+01, -2.40493168e+01, -1.80964018e+01, -7.51349693e+01, -4.64543044e+00, 3.66511646e+01, -7.11802845e-01, -5.71374679e+00, 5.89515298e+01, 2.20529929e+01, 3.12601895e+01, -4.01558412e+01, -3.34640887e+01, 4.92842526e+01, 7.40137609e+00, 5.19400237e+01, -4.12851426e+01, 3.35323836e+01, 4.89280190e+01, -2.86180381e+01, 4.49504327e+01, 6.56459894e+01, -2.33874467e+01, -1.86633648e+01, 1.59400959e+01, -3.43785739e+01, 3.53035379e+01, 4.03687300e+01, 5.56404728e+01, -4.83454700e+01, 7.11755590e+01, -4.57534395e+01, -5.94331002e+01, -5.90326854e+01, -6.12618406e+01, -1.99525561e+01, 2.42189894e+01, -3.65966706e+01, 3.03384567e+01, 1.80167437e+01, 4.03157290e+01, 4.89056771e+01, -5.44576916e+01, -4.47407525e+00, -5.14113419e+01, 3.27879258e+01, 3.75979760e+01, 5.57676898e+01, -3.73786124e+01, -4.54223371e+01, -4.38083878e+00, 2.24094814e+01, -4.28580004e+01, -3.57486461e+01, 3.35952640e+01, -3.26453800e+01, 5.86040483e+01, -4.49852726e+00, 5.07292711e+01, 1.28358207e+01, 1.04491825e+01, 2.27019538e+01, 3.84596327e+01, -2.07566437e+01, -2.48126515e+01, 2.85080678e+00, -4.26544064e+01, -7.39860572e+01, -3.41568497e+01, 3.30919608e+01, -4.01958187e+01, -4.33397845e+01, 1.00993586e+01, 2.94229380e+00, -4.17367755e+01, 3.89109738e+01, -4.31998259e+01, 3.22323081e+01, 5.22795494e+01, 2.37267229e+01, -1.78307061e+01, 5.38728644e+01, 2.43070736e+01, 4.30006627e+01, 3.22245754e+01, 4.89198691e+00, -9.77489426e+00, -3.08357940e+01, -4.00242956e+01, -4.47926401e+01, -2.64553334e+01, 7.76860153e+01, -5.89630779e+00, -5.28848977e+01, 2.55144864e+01, -2.38400279e+01, 4.55283097e+01, 6.91217324e+01, -3.58643527e+01, -3.93771737e+01, 7.10043822e+00, 3.96977819e+01, -7.60042923e+00, 2.72529712e+01, 2.02110184e+01, -4.30732059e+01, 7.68239489e+00, 8.30099241e+01, 1.01958481e+01, 1.22037526e+01, 3.86250646e+00, 1.11920539e+01, -4.62044705e+00, 4.05077692e+01, 2.28704374e+01, 4.77943911e+01, -3.55776934e+01, 2.72142002e+01, 5.49559138e+01, -4.21754861e+00, 9.06267155e-01, 3.87797250e+01, -3.69472830e+01, -4.86244071e+01, 2.88926859e+01, -3.08901267e+01, 4.86871412e+01, 6.39501968e+01, 4.19797152e+01, -8.13750986e+00, 2.35842782e+01, -3.55513911e+01, 1.11339424e+01, -4.47949171e+01, -6.74173860e+00, 2.32307266e+01, -1.01658934e+01, 1.43486894e+01, 1.03992440e+01, 4.06041270e+01, -3.42486154e+01, 6.47813747e+01, -1.43396423e+01, 4.28425399e+01, 4.22380718e+01, -3.38086283e+01, 3.72606395e+01, 4.96917419e+01, 4.59515104e+01, -3.92818182e+01, 7.43598519e+01, 2.50728012e+01, 5.20993552e+01, -4.08342408e+01, 6.94273659e+01, 2.74011444e+01, -3.91215850e+01, -3.64362278e+01, -1.88691551e+01, 3.47164230e+01, -6.07486855e+01, -5.21432051e+01, -2.82182275e+01, 3.62076115e+01, 3.17737917e+01, -2.00920065e+01, -2.23513376e+01, 2.38122750e+01, 4.51698529e+01, 3.51845312e+01, 2.50903619e+01, -7.88694493e+00, -6.34953623e+01, 3.40331163e+01, -5.81489715e+01, -5.22777155e+01, 3.52260594e+01, -4.19378885e+01, 1.48483604e+01, 7.30606068e+01, -2.72496802e+01, 2.94241503e+01, 5.75557737e+01, 5.25101868e+01, 3.01993553e+01, 2.26505297e+01, -2.25847653e+00, -2.05519890e+01, 9.82936405e+00, -2.39938797e+01, -2.41623017e+01, -1.67792253e+01, -1.76618705e+01, -1.11746395e-01, -2.23616014e+01, 7.00950064e+01, -1.52526471e+01, 4.73914139e+01, -4.04611967e+01, -2.39058914e+01, -1.08174045e+01, -3.23232133e+01, -9.82334399e+00, 7.57334567e+01, 1.21563862e+01, 3.62319389e+01, 3.53334554e+01, 1.69381655e+01, 8.95137592e+00, -8.63890141e+01, -5.20059571e+00, 4.79489888e+01, 3.90791739e+01, -2.14756810e+01, 7.56272818e+01, 3.08809809e+01, -3.40151263e+01, -1.40646658e+01, -3.78245139e+01, -1.94616032e+01, 3.53662999e+00, 4.32900340e+01, 4.62603753e+01, 4.63964510e+01, -4.28498236e+01, 1.52823227e+01, -8.46209926e+00, -1.42934922e+01, -1.10281549e+01, 1.71973876e+01, -2.24355790e+01, 2.00943741e+01, 2.01563905e+01, 7.46182144e+00, 1.86674708e+01, 3.47541472e+01, 2.90351207e+01, 5.60779419e+01, -7.55865852e+01, -3.35262719e+01, -4.54697021e+01, -5.55461567e+01, 1.08706441e+01, 1.01759130e+01, 3.70124899e+01, -1.79116208e+01, -2.80971963e+01, -2.00151918e+00, 8.43059837e+00, -4.36293924e+01, 7.27863896e+01, -4.48637541e+01, -6.17073753e+01, -1.20883659e+01, 3.53293303e+00, 1.91819486e+01, -4.04424019e+01, 7.27652098e+01, 2.64057247e-01, 2.12990178e+01, -2.36378153e+01, 1.17235590e+01, 3.89410980e+01, 7.39910811e+00, 1.45584276e+01, 4.11143409e+01, -5.64953663e+01, -3.84930450e+01, -2.81003788e+00, -6.61666386e+01, -2.23750753e+01, -3.28188913e+00, -1.47419778e+01, 1.09047420e+01, 3.17598925e+01, -3.17142621e+01, -3.44770763e+01, 1.43637653e+01, -5.58172048e+00, -2.46095847e+00, -1.47545532e+01, 7.25195549e+01, 1.99530966e+01, -6.46698299e+01, -3.17474107e+01, -2.77225799e+01, -3.61571481e+01, -4.65513910e+01, 1.94982144e+00, -5.08633161e+01, 3.17831879e+01, -2.11351081e-02, 2.14614493e+01, 4.53480479e+01, 5.75636224e+01, -3.96840651e+01, 7.67940498e-01, -2.25557985e+01, -8.31282779e+00, 1.58322306e+01, -4.01656147e+01, 3.93560093e+01, 4.21454028e+01, -3.39693040e+01, 1.34194685e+01, -8.60323819e+00, -5.97480981e+01, -4.29317534e+01, 1.66569871e+01, -3.41038826e+01, 1.76146845e+01, 1.50986105e+01, -1.24310605e+01, -9.53291366e-01, 6.32068830e+01, -3.72660586e+01, -1.93614045e+01, -5.46104041e+01, 1.22651841e+01, 2.58084350e+01, 1.72339751e+01, 5.80438309e+01, 3.37950787e+01, -4.47296927e+01, 1.72146049e+01, 3.52563882e+01, -3.90226345e+01, -1.41478419e+01, -5.78050148e+01, -6.43082165e+01, 3.71909224e+01, 4.86351967e+01, -4.25060506e+01, -4.79668231e+01, -5.18081258e+01, 3.78493640e+01, 5.89136798e+01, -3.24370424e+01, 7.81933623e+00, 2.10321874e+00, -2.54419613e+01, 5.08728728e+00, -2.28199056e+01, 1.45746015e+01, 6.21875947e+01, -4.55604620e+01, -4.55876220e+01, -6.19561733e+01, 2.37464220e+01, 2.24988775e+01, 1.74908164e+01, -3.32913158e-01, 2.89937902e+01, 1.51626509e+01, -4.50008542e+01, -2.17053920e+01, 1.31027095e+01, 5.15144967e+01, -1.74956111e+01, -1.16088736e+01, 5.62342249e+01, -4.06555765e+01, -1.68684884e+01, -3.73604354e+01, -2.59934931e+01, -4.59523228e+01, 6.58896110e+00, -1.92412192e+01, -3.93284951e+01, 4.91040984e+00, 3.72871104e+01, 1.48260121e+00, -3.47860577e+01, -3.91992318e+01, -1.00187439e+01, -9.95429418e-01, -4.27429401e+01, 4.13610160e+01, -6.75843761e+01, -5.08143602e+01, -3.64956621e+01, -1.90032034e+01, -2.62591591e+01, 2.08818090e+01, 2.60792645e+01, 8.04206726e+01, 2.87916425e+01, -8.96669558e+00, -3.14867612e+01, 1.54765173e+01, 5.38478430e+01, 4.61353749e+01, -8.59508013e+00, 2.75847441e+01, 2.90509619e+01, -1.30968076e+01, 4.97452831e+01, -4.78679630e+01, 3.86103738e+01, 8.98952950e+00, -4.55217733e+01, -1.94251974e+01, -2.01136403e+00, 2.30583347e+01, 2.14601973e+01, 6.14229701e+01, 1.07741464e+01, 3.41179639e+01, -3.35174018e+01, -3.46054955e+01, 7.95543745e+01, -8.46454118e+01, -4.27079193e+01, -4.97766002e+01, 1.13827288e+01, -2.67802357e+01, 3.99074347e+01, 3.04109070e+01, 5.04511136e+01, 3.31794983e+01, 4.60958333e+01, -6.24385930e+00, -4.71321614e+01, -4.09792916e+01, -4.28165698e+01, 1.94049337e+01, 4.49031274e+01, -4.36733324e+01, 5.63847938e+01, 1.85221994e+01, -4.88312639e+00, 5.76626873e+01, -7.08877597e+00, 2.66606348e+01, 6.61222494e+01, -2.40335553e+01, -3.61522678e+01, 4.21388649e+00, -3.48974323e+01, 3.55323901e+01, -4.26803839e+01, -3.95023633e+00, -2.54367663e+01, -1.87746720e+01, 3.89913450e+01, -2.59989085e+01, 1.64875032e+01, -3.84226751e+01, 3.30011977e+01, -8.45507191e+00, 4.39149782e+01, 1.36031743e+01, -4.49615002e+01, 3.30095652e+01, 3.47574632e+01, 3.07475228e+01, -7.96012172e+01, -1.77723090e+01, 2.37576026e+00, 3.52857576e+01, 1.67291356e+01, 4.17751107e+00, 4.57135517e+01, 4.55952805e+01, 4.30822564e+01, 4.13778460e+01, -1.88433045e+01, -3.97719328e+00, -4.52438256e+01, -7.64558587e+00, -4.62043765e+01, -3.72133305e+01, 1.91682339e+00, 4.65951772e+01, 3.31797538e+01, 3.32130853e+01, 4.31756754e+01, -3.53976338e+01, -1.65755169e+01, 5.81661938e+01, 2.89596733e+01, -4.42894857e+01, 1.91692167e+01, -7.85215584e+01, -1.49927642e+01, 2.31966698e+01, 2.35594455e+01, -5.32446781e+01, 2.59125944e+01, -1.55518649e+01, -2.36867194e+01, -4.39762263e+01, -1.12657896e+01, -4.28553041e+01, 3.82188351e+01, -4.63685142e+01, 6.04863188e+01, 1.31186243e+01, -2.67554049e+01, 3.34216698e+01, -6.59551586e+01, -4.11897265e+00, 5.74088419e+01, 4.56265901e+01, -5.62732230e+01, -2.25580011e+01, -7.15428402e+01, 9.59107253e+00, 4.66173364e+01, 3.73432597e+01, 3.83074580e+01, 4.95513961e+01, 4.09423890e+01, 1.23599371e+01, -2.22883810e+01, -1.13976529e+01, -6.52959009e+01, -6.94664337e+01, 5.22742406e+01, -3.26729953e+01, 4.43222769e+01, -1.89903937e+01, -5.62091743e+01, -2.71556849e+01, 3.46557386e+01, -4.97410417e+01, 8.86210940e+01, -5.37122991e+01, -2.24449443e+01, 6.35892547e+01, -1.86347517e+01, -2.16568043e+01, 1.26984495e+01, 1.23186914e+01, -6.08390787e+01, 6.96695718e+01, -4.14660585e+01, 1.83586533e+00, -4.43411778e+01, -4.80152285e+01, 5.38745259e+01, -2.32797256e+01, -4.66526336e+01, 2.81789216e+00, 1.29787085e+00, -5.06743380e+00, 5.01366622e+00, 7.79264893e+00, -1.07415803e+01, -1.67527615e+00, 1.77887497e+01, 4.04535550e+01, 4.72292146e+01, -2.91842988e+01, -5.37933225e+01, 3.92274750e+01, 6.73779517e+01, 5.75088693e+01, -6.33395474e+01, 3.01412767e+01, -3.71673669e+01, 1.11298334e+01, 2.71773820e+01, -3.33729191e+01, 4.25802511e+01, -4.47771022e+01, 3.27858550e+01, 2.70916278e+01, 4.19355610e+01, 7.90967712e+00, 1.40661684e+01, -2.97591946e+01, -3.86865628e+01, 3.28085660e+01, 5.91234150e+01, -6.56359383e+01, 2.94383903e+01, -4.92877718e+01, 1.93338410e+01, 4.94147237e+01, -3.78577287e-01, 4.43873530e+01, 4.14760554e+01, 2.41361751e-01, -3.08319426e+01, -4.73545266e+01, -2.77662373e+01, -5.34086276e+01, 5.04376126e+01, 3.89412924e+01, -3.55495612e+01, 7.80703706e+01, 3.19396477e+01, 5.71325449e+00, 8.36321985e+00, 3.62942721e+01, 3.46120150e+01, -1.27101000e+00, -5.90174423e+01, 4.12150694e+01, -3.91666000e+01, -4.07492745e+01, 4.84056106e+00, -5.63435613e+01, 2.17246845e+01, -3.96339985e+01, -4.06552756e+01, -5.73470557e+01, -6.38053176e+01, 3.08462450e+01, -2.93857921e+01, 3.54605795e+01, -9.10071489e+00, 4.68235651e+01, 7.82164496e+01, -7.05260739e+00, -1.95387005e+01, -1.77118773e+01, -4.11302061e+01, -2.86271651e+01, 2.81820151e+01, 3.34114052e+00, -6.31247328e+01, 4.60305044e+01, 2.80201191e+01, -3.38486567e+01, -3.34597325e+01, 1.95973265e+01, 2.89099734e+01, -1.23291897e+00, 6.05381036e+01, -6.80885977e+00, -2.32475666e+00, 3.44439169e+01, -1.69731446e+01, 4.48694206e+01, 6.77039235e+01, 5.50774042e+01, 3.10701988e+01, -3.04364226e+01, 3.95050908e+01, -7.04083472e+01, -1.22835853e+01, -4.42184703e+01, 4.84492500e+00, -4.30878092e+01, -6.79036715e+01, 2.65959948e+01, 2.35260938e+01, 2.05956012e+01, 3.13871204e+01, 5.33355462e+01, -3.00087639e+01, 8.55202236e+01, -2.60111727e+00, 1.80592688e+00, -1.77334632e+01, -2.61783224e+01, -4.43763310e+01, -3.34504369e+01, -1.56780720e+01, 2.78512442e+01, 3.20900995e+01, 3.22620374e+01, -2.60283979e+01, 1.39222312e+01, 7.82406045e+00, 3.45786973e+00, 2.44825739e+01, 4.23410080e+01, 3.80148862e+01, -4.82071587e+01, 1.19233957e+01, 4.62334242e+01, 2.86857271e+01, -4.20284758e+01, -3.94600769e+00, -5.24505125e+01, -2.50727851e+01, 3.88068287e+01, 1.21314967e+01, -1.17773570e+01, 1.50280625e+01, 1.13832071e+01, -2.33893116e+01, 4.77897224e+01, -3.50452949e+01, -5.95098008e+00, 2.84890951e+00, -3.17615360e+00, 1.06662074e+01, -2.86471359e+01, 3.36440321e+01, 4.29439375e+01, 5.07097099e+01, -2.21674478e+01, -1.74232139e+00, -2.10674438e+01, 2.81679771e+01, -4.08229737e+01, 5.52258023e+01, -2.30852446e+01, -1.84862574e+01, 7.18865039e+01, 2.52602104e+01, -4.40197696e+01, 4.06149342e+01, -3.74229080e+01, 2.29507975e+01, 1.99227183e+01, -3.18162234e+01, 4.44420171e+01, -5.03244938e+01, 2.99728372e+01, 3.97697487e+01, 3.64050179e+01, -4.73485703e+01, 9.68151485e+00, 2.59611957e+01, 6.28861041e+00, -2.72616453e+01, 8.24731924e-02, -3.61091905e+01, -3.58362608e+01, -5.05388739e+01, -8.81762153e+00, 2.49258217e+01, 3.81043557e+01, 6.20687887e+01, -2.40973788e+01, -4.43476975e+01, -6.32019321e+00, 3.22518954e+01, -4.60054602e+01, -1.60164657e+01, -3.15410502e+00, 1.06227733e+01, 3.00681917e+01, -4.99757069e+00, -2.18771600e+01, -4.07011697e+01, -4.91130200e+01, -3.43018842e+01, -2.30975229e+01, 1.01918931e+00, -4.19967725e+01, -6.13203085e+01, -2.58188061e+01, -3.89511903e+01, -8.43876716e+00, 4.20466186e+01, -2.70015254e+01, 4.67001838e+01, 4.00583511e+01, 9.84360694e+00, 2.23930736e+01, -6.44168958e+01, -3.55449817e+01, -4.19947349e+01, 2.79800583e+01, 3.30810121e+01, -3.97917215e+01, -6.39662539e+00, 5.62333398e+01, 4.84018874e+01, -5.45593822e+01, 1.21196608e+01, 4.55986376e+01, 6.64708863e+01, 6.01710753e+01, -1.49387338e+01, -3.65161600e+01, 7.03148665e+00, -5.50012093e+00, 3.61412371e+01, -2.46260346e+00, -4.88411726e+01, -1.20760543e+01, 5.57082021e+01, 5.01696473e+01, -3.76673792e+01, -1.24313471e+01, -7.43314663e+01, 4.01151026e+01, 7.77036437e+00, 3.22376999e+01, 2.27910780e+01, -5.39743804e+01, 1.60825240e+00, -3.97969062e+01, -6.06763851e+01]) - local_datetime(location, local_time)datetime64s2021-06-01T18:00:00, 2021-06-01T19:00:00, ..., 2021-06-05T09:00:00, 2021-06-05T10:00:00
Values:
array([['2021-06-01T18:00:00', '2021-06-01T19:00:00', '2021-06-01T20:00:00', ..., '2021-06-04T15:00:00', '2021-06-04T16:00:00', '2021-06-04T17: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'], ['2021-06-02T16:00:00', '2021-06-02T17:00:00', '2021-06-02T18:00:00', ..., '2021-06-05T13:00:00', '2021-06-05T14:00:00', '2021-06-05T15: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'], ['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-02T11:00:00', '2021-06-02T12:00:00', '2021-06-02T13:00:00', ..., '2021-06-05T08:00:00', '2021-06-05T09:00:00', '2021-06-05T10:00:00']], dtype='datetime64[s]') - local_time(location, local_time)float64s6.480e+04, 6.840e+04, ..., 3.240e+04, 3.600e+04
Values:
array([[64800., 68400., 72000., ..., 54000., 57600., 61200.], [32400., 36000., 39600., ..., 21600., 25200., 28800.], [57600., 61200., 64800., ..., 46800., 50400., 54000.], ..., [32400., 36000., 39600., ..., 21600., 25200., 28800.], [25200., 28800., 32400., ..., 14400., 18000., 21600.], [39600., 43200., 46800., ..., 28800., 32400., 36000.]]) - location(location)vector3km[-5681.09549258 -207.59877736 2876.05593684], [2197.08004503 5965.51656095 -418.44048172], ..., [ 3923.22431629 2927.26677503 -4077.87459247], [ -132.11070946 3117.34714775 -5554.66781373]
Values:
array([[-5681.09549258, -207.59877736, 2876.05593684], [ 2197.08004503, 5965.51656095, -418.44048172], [-6246.71329892, 925.03876945, 844.10736051], ..., [ 1982.7347829 , 6051.97754339, 178.80602612], [ 3923.22431629, 2927.26677503, -4077.87459247], [ -132.11070946, 3117.34714775, -5554.66781373]]) - longitude(location)float64deg-177.907, 69.781, ..., 36.728, 92.427
Values:
array([-1.77907227e+02, 6.97814143e+01, 1.71576623e+02, -1.68407950e+02, 6.97039238e+01, -5.62001874e+01, -1.16360817e+01, 1.53217131e+02, -1.46156386e+02, -1.34321918e+02, 6.10963394e+01, 1.68484246e+01, 6.00320138e+01, 1.59077947e+02, -1.25097794e+02, 4.12714828e+01, -1.22510424e+02, -4.54665126e+01, -1.61524941e+02, -1.19592484e+02, -1.53735115e+02, -1.29565121e+02, 6.54089242e+01, -6.74348220e+01, 4.97470177e+01, -1.65422024e+02, 1.68900920e+02, 1.41355989e+02, 1.56818359e+02, -9.20195626e+01, -1.21627778e+02, -2.82091073e+01, 1.70628577e+02, 1.55700867e+02, -1.45972187e+02, 1.70642106e+02, 1.04041169e+02, 1.52222420e+02, -6.44874201e+01, 1.56883011e+02, 1.58874754e+02, -3.04313488e+01, -2.15575203e+01, -1.35356010e+02, -1.58684539e+02, -1.15692052e+02, -1.14467766e+02, -1.35841849e+02, 1.36939274e+02, 6.03775856e+01, 1.22522945e+02, 8.24967611e+01, 1.44282907e+01, 6.82589360e+01, 9.15655586e+01, -1.08294793e+02, 1.44773553e+02, -9.48916193e+01, 1.67948597e+02, -2.51975608e+01, 1.48970004e+01, -8.21073273e+01, 3.38742552e+01, -1.10206988e+02, -5.98695245e+01, 1.43903578e+02, -5.31488881e+01, -1.31851515e+02, -1.26704988e+02, 5.55593686e+01, 1.27948330e+02, 1.76378306e+02, 2.37738435e+01, -1.45987267e+02, -1.07842620e+02, -1.17844568e+02, 1.59807284e+02, 9.37344046e+01, -1.18873487e+02, 1.55922420e+02, 1.09592399e+02, 1.42458643e+02, 1.63405465e+02, -3.40201620e+00, -1.47016991e+02, 1.46796031e+02, 1.79355582e+02, 1.22777914e+02, -1.26058759e+02, 3.68861110e+01, 1.13082276e+02, 1.33532337e+02, -1.16599828e+02, 4.54478226e+01, 2.51319834e+01, 1.47429580e+02, 9.06118114e+01, 2.26039178e+01, -9.69184509e+01, -4.30264769e+01, 1.20816158e+02, 1.28468435e+02, -4.12218776e+01, -5.52823723e+01, 7.35199067e+01, -1.59322830e+02, -7.18840173e+01, -4.63827476e+01, 7.04620311e+01, -1.17812166e+02, 1.19764898e+01, -1.52287545e+01, 1.70132825e+02, -7.97819869e+01, -3.50098373e+01, -9.76302076e+01, -7.78108194e+01, -1.01648770e+02, -4.34120549e+01, 5.48803389e+01, -3.06679154e+01, -1.28339009e+02, -1.14259788e+02, -1.60994067e+02, -1.14867068e+02, 1.78710847e+02, 5.59921103e+01, 3.95373643e+01, 1.99989772e+00, -3.50034301e+01, -7.02317254e+01, 2.91773106e+01, 1.16823229e+02, 1.06739086e+02, 1.32653285e+02, -1.71848451e+02, 4.64103794e+01, -6.76795360e+01, 7.22970163e+01, -6.19230899e+01, 1.63382088e+02, 1.60472055e+01, 5.22252619e+01, -6.92012843e+01, -1.14039602e+02, -1.31057454e+02, 4.69213717e+01, -8.03083906e+01, 1.46079582e+02, 1.54680498e+02, 5.09936855e+01, -6.50595890e+01, 1.86525367e+00, -1.32001124e+02, -6.68823641e+01, 1.15189402e+02, 1.30223259e+02, -1.34245583e+02, -1.70616136e+02, -2.89546470e+01, -1.41839738e+02, 1.74684045e+02, -7.51876038e+01, -1.66554072e+01, 1.20734308e+02, -1.57512506e+02, 8.07968549e+01, 1.28982179e+02, -1.45868442e+02, -8.99470583e+01, 1.60297749e+02, -2.89678346e+01, 1.43412804e+02, -5.96620981e+01, 3.48325395e+01, 1.31594341e+02, 1.45788997e+02, 1.48305344e+02, -1.45370993e+02, -1.30256775e+02, 1.59948254e+02, -1.32465473e+02, -4.90554250e+01, 1.46268986e+02, -1.13382123e+02, -1.11152528e+02, 1.59213535e+02, 1.40443296e+02, -3.42238088e+01, 8.17644886e+01, 1.31849100e+02, 1.18991792e+02, -6.89341405e+01, -9.42668074e+00, 3.37272302e+01, -6.86034408e+01, -2.65408953e+01, 1.24157733e+02, -1.16154870e+02, 3.90874750e+01, 6.60971951e+01, 4.71679842e+01, -4.49141158e+01, 2.87912710e+01, 3.98565772e+01, 1.71016815e+02, 2.83073347e+01, -1.36235710e+02, 1.36297988e+02, 1.42605137e+02, 1.10980092e+02, -1.59612423e+01, 1.24743505e+02, 4.53088281e+01, -3.37399263e+01, -1.26798483e+02, -9.45253672e+01, 1.53595085e+02, -1.54873361e+02, 4.14710478e+01, 1.44447743e+02, 1.60452402e+02, 1.14977184e+02, 4.52026085e+01, -6.67353840e+01, -5.49642631e+01, -1.55259651e+02, 7.34889223e+01, -1.36504047e+02, 6.45348001e+01, 1.31389469e+02, 2.53701308e+01, 3.41992136e+01, 1.27980274e+02, 1.56497794e+02, 4.39428604e+01, 1.01203857e+02, -3.96564608e+01, 1.12126079e+02, -1.55508636e+02, 1.33596132e+02, 8.41691725e+01, 9.91941261e+01, -1.21054231e+02, -1.30299720e+01, 8.34653736e+01, 6.32828253e+01, -9.86602924e+01, 1.37355459e+02, -1.73504128e+02, -4.93421400e+01, 2.36189129e+01, -1.42684516e+02, -1.16080491e+02, -5.62581113e+01, -1.49778119e-01, -4.39530362e+01, 7.29301700e+00, 2.43406349e+01, 2.88027132e+01, -1.16388259e+02, 6.43954192e+01, 1.70765062e+02, -2.39887270e+01, 1.08634304e+02, -1.43225013e+02, -1.24503385e+02, -1.01987974e+02, 5.92635425e+00, -1.57258708e+02, 8.40956072e+01, -1.12161034e+02, -1.08968396e+02, -1.40914846e+02, -1.33499546e+01, 1.05505855e+02, -1.01366104e+01, -2.47739011e+01, 1.30615894e+02, -1.32886733e+02, 1.35425420e+02, -7.31048235e+01, -1.50643756e+02, -5.67880859e+01, 1.04994913e+02, -1.21054888e+02, 3.39501046e+01, -1.59115834e+02, -1.13549821e+02, -5.67295373e+01, 3.76451842e+01, 1.57370483e+02, 3.58289617e+01, -5.71173709e+01, 1.22307801e+02, 2.57877761e+01, 1.46245817e+02, 4.88558441e+01, 4.59763263e+01, 2.01982514e+01, -1.64606109e+02, -8.21370443e+01, -5.08093646e+01, -1.30170789e+02, -4.16888611e+00, 1.23637648e+02, -8.42738073e+01, 1.42337209e+02, -4.49464397e+01, 1.39366634e+02, 7.91835995e+00, 1.27684852e+02, 1.21021407e+02, 4.27057221e+01, 6.14851047e+01, -1.45088868e+02, 1.00886612e+02, -5.34106688e+01, 2.56396483e+01, -3.76341434e+01, -1.05972028e+02, 1.39429586e+02, 1.51308593e+02, -1.11159150e+02, 1.01170197e+02, 1.11616555e+02, -2.31411114e+01, 1.23666004e+01, 1.55946414e+02, -1.20782446e+02, 6.53930049e+01, -1.39420508e+02, 5.40695280e+01, -7.39224367e+01, -8.80453400e+01, 3.11396285e+00, 1.94121858e+01, -1.12448048e+02, 1.65749161e+02, -3.33085314e+01, 4.28059935e+01, -9.17074469e+01, 5.75203100e+01, 4.19455242e+01, -1.61820225e+02, 1.25100330e+02, -9.61282831e+01, -1.34054429e+02, 1.14901748e+02, 3.94444857e+01, -1.79216698e+02, -1.47611017e+02, 4.13236889e+01, 1.04054376e+02, -1.70693225e+02, -2.12647553e+01, -4.47681348e+01, 7.70205789e+00, -9.06020116e+01, 7.05698519e+01, -5.33254208e+01, 1.56092097e+02, -1.50260137e+02, 5.39753853e+00, 1.28317824e+02, 4.43808105e+01, -3.08262167e+01, 1.71628325e+02, 2.22066498e+01, -6.54756476e+01, -3.05025986e+00, 5.99335243e+01, -1.29741726e+02, -9.78929277e+01, -1.21776286e+02, 6.29602384e+01, 1.01924005e+02, 4.88827422e+01, 1.25006989e+02, 1.74807695e+02, 9.79715422e+01, -4.52348171e+01, 1.32127769e+02, -2.80697265e+01, -1.58528651e+02, -1.47325303e+01, -1.39131135e+02, -1.58674984e+02, -4.06703759e+01, -1.33469316e+02, 9.25604401e+01, -1.27339565e+02, 8.37143469e+01, -1.51972638e+02, 3.79844398e+01, -3.88605573e+01, -4.92432055e+00, 5.82660754e+01, 1.21674373e+02, 3.48075891e+01, 3.62222773e+01, 6.37734855e+00, -3.61022900e+01, -1.73171377e+02, -8.91221755e+01, 3.99003494e+01, -5.99901328e+01, -1.10827479e+02, 9.09872839e+01, 6.63181013e+01, 1.71994344e+01, 1.38123338e+02, -1.13277046e+02, -1.22273173e+02, -8.30161796e+01, -1.41221628e+02, 7.73822156e+01, 1.22912429e+02, -1.60036552e+01, 1.45790159e+02, 3.11742977e+01, 6.51698326e+01, 1.33480229e+02, 1.13603301e+02, -4.10573666e+01, -5.01263944e+01, 1.27630889e+01, -1.30200252e+02, -5.81536008e+01, -1.43165258e+02, -1.37115641e+02, 1.36777712e+02, 1.58777043e+02, 1.33829831e+02, 4.95869303e+00, -5.95060381e+01, -2.90411903e+01, -6.57320806e+01, 4.12692693e+01, -1.05673519e+02, -1.43169185e+02, 1.02022354e+02, 1.45257432e+02, -4.01383739e+01, 3.39759056e+01, -8.49464775e+01, -1.26497366e+02, 3.52609348e+01, 1.23301097e+02, -8.80286201e+01, -4.65864852e+01, 1.46998025e+02, -5.00406001e+01, 5.65304872e+01, 2.75533262e+01, 3.08498184e+01, -1.45144533e+02, 7.49178351e+01, 8.10893808e+01, 1.50035424e+02, -1.78370892e+02, -1.12032993e+02, 1.66610684e+02, -1.36525772e+02, 2.46597810e+01, -1.63996134e+02, -1.62747319e+02, -1.19809808e+02, 1.21434053e+02, 8.77326057e+01, -1.65048913e+02, 2.54004100e+01, -4.87734453e-01, -1.30270088e+02, -4.05989704e+01, 1.52555099e+02, -1.45982386e+02, 8.15891011e+01, -1.05163440e+01, -1.20655610e+02, -9.70073884e+01, -3.60408912e+01, 1.35055548e+02, -7.12753864e+01, -1.42852647e+02, 1.73763323e+02, 5.65148431e+01, -8.43690117e+00, -1.34799884e+02, -6.05559270e+01, -3.61837554e+01, -1.39826776e+02, -6.50281885e+01, -1.16728074e+01, 1.15127443e+02, -4.65215983e+01, 1.01987774e+02, -1.22974674e+02, 1.63479326e+02, -2.77088109e+01, -1.27693932e+02, -1.34239223e+02, 1.62485113e+02, -1.30990700e+02, -1.69118856e+02, -1.77928356e+02, 7.87825357e+01, 1.20965114e+01, 3.27966202e+01, 3.31624326e+01, -7.18017115e+01, -1.58386814e+02, 1.15233061e+02, -1.18003403e+02, 4.47602558e+01, -2.47368596e+01, -8.26673112e+01, 1.07142364e+02, 4.82405208e+01, 9.06160211e+01, 8.95471840e+01, -4.30178454e+01, -3.97758803e+01, -1.30540257e+02, -4.72722411e+01, -1.18742882e+02, -7.52583290e+01, -1.62841349e+02, -4.08294477e+01, 4.94513671e+01, 3.93317037e+01, -1.42030319e+02, -1.53550593e+01, 1.78341904e+02, 1.26201917e+02, -1.55266305e+02, 1.60049615e+02, 4.94087887e+01, -2.75417006e+01, -1.04607911e+02, 7.57299958e+01, -5.25497181e+01, 2.61078058e+01, -2.81215572e+01, 7.45028599e+01, -7.38695894e+01, 1.25229381e+02, 4.72051378e+01, -6.31667948e+00, -1.55645175e+01, 5.88524629e+01, 1.03101035e+02, -1.29061537e+02, -1.60712636e+02, 1.18699138e+02, 6.62163913e+01, -1.41667569e+02, 4.99199541e+01, -8.64510835e+01, -1.39243569e+02, -1.22141101e+02, 1.66370870e+02, -7.46024109e+01, -7.76871442e+01, 1.12313903e+02, 1.47754841e+02, -4.72024896e+01, -1.03234815e+02, 1.27876963e+02, -9.46184434e+01, -4.61977925e+01, 6.02795970e+01, 5.35023957e+01, -1.12520793e+02, -1.11869768e+02, -1.27481857e+02, -1.54605131e+02, 4.17439979e+01, 1.28246540e+02, -4.27576469e+01, -1.30664366e+02, -1.32563515e+02, -3.82998392e+01, -1.76666406e+01, -1.99439694e+01, 1.14500467e+02, -5.27629615e+00, 4.51632328e+01, -1.03922168e+01, -2.24192338e+01, 4.39211080e+01, -1.11985587e+02, -1.40413873e+02, 5.18274599e+01, -6.01860255e+00, 9.22149576e+01, 2.78885403e+01, 7.06534013e+01, -1.03256570e+02, -2.74440247e+01, -3.77724186e+01, 7.82771897e+01, 3.72668407e+01, -6.04199590e+00, 1.39150786e+02, 1.42665905e+02, -1.02311560e+02, -9.55038876e+01, 1.16505677e+01, -1.60909182e+02, -1.54465889e+02, -2.54241753e+01, -1.00476055e+02, -4.09168713e+01, -5.80707204e+01, -1.57712712e+02, -1.42782201e+02, 4.43945310e+01, -3.75629233e+01, 3.44388485e+01, -6.06238948e+01, 1.38060687e+02, 1.72536292e+02, -1.62829758e+02, -1.54485512e+00, 1.16356029e+02, -1.14243769e+02, -1.41159625e+02, -1.17839946e+02, 4.53344271e+01, 5.08642441e+01, 4.65382635e+01, -1.65459616e+02, 3.16521959e+01, -1.04430687e+02, 4.24251835e+01, 4.07694263e+01, 9.55102640e+01, 9.42704770e+01, -1.70986707e+02, 3.66156447e+00, 1.77956580e+02, 8.47615100e+01, -1.12011405e+02, 1.07278205e+02, 4.76930557e+01, 1.18932402e+00, -1.02366072e+02, 5.16745694e+01, 2.45703769e+01, 1.75039810e+02, -1.70397831e+02, -1.29774819e+02, 1.43138380e+02, 7.98478515e+01, 3.17533896e+01, 1.03623414e+02, -1.45129068e+02, -2.43126196e+01, -1.44866157e+02, -6.19843397e+01, 6.17516665e+01, -1.33755704e+02, -6.28667352e+01, -4.67323214e+01, 5.28540291e+01, 3.97885780e+01, -1.38402939e+02, 9.85761530e+01, -3.53041534e+01, 8.82946807e+01, -1.65057661e+02, -1.69170629e+02, -9.77559585e+01, 1.06580975e+02, 1.50196807e+02, -1.49432944e+02, 6.07907610e+01, 5.07303829e+01, 7.32654489e+01, -1.36115890e+00, 1.34238316e+02, -2.04673029e+01, -4.44789063e+01, 4.38491961e+01, 9.03084901e+01, -4.95840775e+01, -1.19507698e+02, -1.69335242e+02, 4.27047131e+01, 5.83280648e+00, 1.20258125e+02, -1.58305468e+01, -1.27851004e+02, 1.12687054e+02, -9.42262209e+01, 9.00911500e+01, -9.27837160e+01, 1.33714542e+02, -1.36295460e+02, -1.46641765e+02, 1.41612577e+02, 1.06309970e+02, 3.39035674e+01, 6.66420124e+01, 9.05274959e+01, 1.29420576e+02, -5.01233987e+01, -8.70718759e+01, 1.72505239e+02, -1.67075620e+02, 1.47387330e+02, -3.41987937e+01, -1.61472548e+01, 3.98706314e+01, -1.50632188e+02, -1.35306627e+02, -1.57701348e+02, -3.88890633e+01, 1.56784045e+02, -1.64603200e+02, -8.87957767e+01, 1.37739261e+02, 1.26375042e+02, -1.25614528e+02, 7.65141793e+01, 4.96653431e+01, -9.83009378e+01, -3.70487205e+01, 1.69863339e+02, -4.61358482e+01, -1.71444416e+02, -7.84659049e+01, -1.16997349e+02, 4.19914448e+01, 6.03189085e+01, -1.28530034e+01, -6.50333254e+01, 1.45871831e+02, -5.13288501e+01, 1.07832048e+02, 4.68694107e+01, -7.34293020e+01, -1.71890156e+02, 5.63971930e+00, 1.41531006e+02, -6.88423486e+01, 1.35611100e+02, -1.53448620e+02, 9.57828097e+01, -8.44466104e+01, -1.35585086e+02, 1.58238428e+02, -1.33978005e+02, 7.98971528e+01, 1.05788146e+02, 1.06620332e+02, -4.53366425e+01, -8.64320420e+01, -1.34436666e+02, 1.31759763e+01, -4.86628705e+01, -3.23363423e+00, 1.49689693e+02, 2.85272235e+01, -1.55136502e+02, -1.68260787e+02, -8.12036644e+01, -9.45246000e+01, -2.56672102e+00, -1.58084798e+02, 1.20226219e+00, -1.37625824e+02, -1.76732480e+02, 1.75070622e+02, -1.57881222e+02, -1.55208254e+02, 4.03697452e+01, 2.81197621e+01, 1.49739099e+02, -1.24978682e+02, -1.10683812e+02, -1.77549803e+02, -1.50024027e+02, -1.39003727e+01, -1.67595627e+02, -7.20785729e+01, 3.31843547e+01, 1.11932969e+02, -1.46041336e+02, 3.72886160e+01, -1.54203167e+02, -7.19964092e+01, -2.39609430e+01, -1.40365839e+02, -4.90758480e+01, 1.68503384e+02, -5.63106310e+01, 4.23031152e+01, 7.52905993e+01, -6.99838216e+01, 1.39146798e+02, -1.03486337e+02, -2.17408120e+00, 1.25977789e+02, 9.48718454e+01, 1.34269160e+02, -8.11562215e+01, -1.31167689e+02, 9.34150140e+01, 1.74023629e+02, 3.15564247e+01, 1.17168921e+02, -7.34005476e+01, 1.44830182e+02, 6.71328901e+01, 1.12952832e+02, -1.79638304e+02, 6.46274660e+00, -1.70832250e+02, 1.34066301e+02, 5.28656748e+01, 3.43053623e+01, 8.38366101e+01, -5.20040516e+01, -1.41171530e+02, 5.87741508e+01, 1.57906025e+02, 3.11613476e+01, -1.38218885e+02, -1.57423589e+02, 5.40948514e+01, 1.61984872e+02, -4.96147697e+01, 1.48432676e+02, -5.98563558e+00, -5.86782061e+01, -1.31455488e+02, 4.79771142e+01, -6.00250075e+01, 4.30735981e+01, -1.70561166e+02, -1.46280502e+02, -1.00332632e+02, 5.15556337e+01, 1.20149141e+02, 6.51603530e+01, 9.54223465e+01, -1.34534687e+02, 2.34369011e+01, -8.27179242e+01, 2.48479514e+01, 2.35995957e+01, -4.11870802e+01, 1.87725467e+01, -1.16335361e+02, 1.45207802e+02, 3.34341074e+01, 6.00114929e+01, 1.45602147e+02, 9.85002141e+01, -3.51971505e+00, 1.13852211e+02, -1.29609334e+02, -8.86737704e+01, 4.53608230e+00, 1.79319390e+02, 9.01169299e+01, -9.44939989e+00, 3.37884338e+01, -5.92499917e+01, -1.29889635e+02, -1.31581922e+02, 8.52607781e+01, -1.33685398e+02, 1.13105014e+02, 3.97315226e+01, -6.53791507e+01, -1.79884242e+02, -4.83083557e+01, 1.51577371e+02, 3.78178426e+01, 9.91401296e+01, 2.13499549e+00, 1.74088563e+02, -1.28029041e+02, 8.03509551e+01, -1.19852513e+02, 1.76969387e+02, 1.22039550e+02, -1.03348661e+02, 9.43406280e+01, 1.24556141e+02, 1.10173311e+02, 6.25110485e+01, -1.48727807e+02, 2.69451657e+01, -4.24799472e+01, -1.26490936e+01, -1.67441256e+00, 2.90080958e+01, 7.68580257e+01, -1.27202394e+01, 1.32482971e+01, -1.52355576e+02, -1.24140227e+02, 4.42428530e+01, 5.20762423e+01, -2.34241175e+01, 5.84748377e+01, -7.86044787e+01, 3.18774619e+01, 1.34324306e+02, -1.58823639e+02, -1.53455096e+02, -1.27175970e+02, 1.52825730e+02, 9.06590915e+01, -3.87474401e+01, -5.43902272e+01, 7.30110191e+01, -5.44763288e+01, 4.52042419e+01, -2.16684114e+01, -1.02013495e+02, -1.05451305e+02, 6.80547331e+01, 7.23244215e+01, 3.95660405e+01, -1.04357926e+02, -1.61141659e+02, -1.07039862e+02, -1.47152893e+02, -1.12182484e+02, -1.07385182e+02, 2.07022896e+01, -6.15397384e+01, -1.12368003e+02, 3.11628699e+01, 1.55433026e+02, 1.74739569e+02, 4.24853016e+01, -1.73581704e+01, 2.82004006e+01, -1.41756017e+02, 1.32892350e+02, 4.93231545e+01, -5.22694418e+01, -9.42954485e+01, 1.50399443e+02, 7.98984618e+01, 4.96403485e+00, -1.31142855e+02, 5.30906077e+01, 1.62004611e+01, -1.65514559e+02, -1.49093349e+02, 1.57775798e+02, -3.27373811e+01, 1.01553009e+02, 4.05031324e+01, -2.46576981e+01, 7.79451053e+01, 1.09269723e+02, -1.49672947e+02, 1.96754377e+01, -7.81820537e+01, 6.62360804e+01, 1.59337752e+02, 5.29808173e+01, -1.52650922e+02, -1.67151502e+01, 1.44582213e+02, 1.61542157e+02, -1.63662994e+01, -9.75367600e+01, 6.92020034e+01, 1.26456594e+00, -3.80947556e+01, 1.58502787e+02, 2.95513052e+01, -1.29477034e+01, -9.02982074e+00, -1.45500961e+02, -1.42494863e+02, -9.65956944e+00, -3.21680186e+01, -1.24515055e+01, 1.61269013e+02, 1.38138563e+02, -5.24255582e+01, 8.98636260e+01, 1.38745287e+02, -1.15411658e+02, -5.80345807e+01, -4.07929646e+01, 1.25387319e+02, 7.18602899e+01, 3.67280184e+01, 9.24266978e+01])
- (location, local_time)float64counts6.190, 5.929, ..., 1.809, 2.244
Values:
array([[6.19033624, 5.92909402, 6.05922954, ..., 5.91971348, 6.9419554 , 6.05233451], [2.01299408, 2.41134858, 3.13658826, ..., 0.79976679, 0.98146891, 1.41957401], [6.7450953 , 6.482127 , 6.21134135, ..., 5.74106877, 6.56851058, 6.46532304], ..., [4.10879429, 4.38579154, 4.5993279 , ..., 3.26559588, 3.09482718, 4.11986245], [0.44725708, 1.4689661 , 1.33659516, ..., 0.66860974, 1.09997591, 0.42284013], [2.50747048, 3.07785673, 3.94903195, ..., 1.19749155, 1.80880926, 2.24393213]])
In the above:
latitudeandlocal_timecoordinates have been computed as requested.The intermediate results
local_datetimeandlongitudewere preserved as unaligned coordinates (usekeep_intermediate=Falseto drop them).The
locationanddatetimecoordinates (which have been consumed by the transformation) have been converted to unaligned coordinates (usekeep_inputs=Falseto drop them).The
datetimedimension has been consumed by thelocal_timecoordinate and thus renamed tolocal_time(userename_dims=Falseto disable). For more details see section Renaming of Dimensions.
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'), latitude=latitude, local_time=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.hist(latitude=36, local_time=24).plot()
[15]:
Renaming of Dimensions#
This section is somewhat advanced and not required to understand the basic usage of transform_coords.
As shown above, transform_coords can rename dimensions of the data array if it processes dimension-coordinates. The rules controlling it are described in this section. They are generic and tend to favor not renaming a dimension if it is not entirely clear what the new name should be.
A dimension is only renamed if its dimension-coordinate can be uniquely associated with one output coordinate of transform_coords. In the example above, there are two dimension-coordinates in the input, datetime and location. The latter is used to compute two new coordinates, namely longitude and latitude. It is thus not possible to find a unique new name for the location dimension. datetime on the other hand is used to construct only a single coordinate,
local_datetime, which is finally transformed into local_time. The datetime dimension is therefore renamed to local_time.
Identifying outputs with dimension-coordinates can be expressed as a graph-coloring problem. We assign a unique color to each dimension-coordinate (coordinate name matching a dimension of the coordinate); other coordinates are left uncolored (black). We then propagate colors through the directed graph using the following rules
If a node has exactly one colored parent, use that parent’s color (graph 1).
If a node has several colored parents, leave the node black (graph 2). The same happens if no parent is colored.
If a node has more than one child, it is not counted for rules 1 and 2; its color is not applied to its children (graph 3). Other colored nodes are free to apply their color to shared children (graph 4). It makes no difference if the children are computed by the same function or from multiple functions.
All graphs used by transform_coords are directed acyclic graphs, but they can still have undirected cycles. In those cases, it can be possible to identify an output with a dimension-coordinate even when it has multiple children as part of a cycle.
If a cycle has one and only one colored node as input (w.r.t. directions of the edges) and exactly one output, that output takes the color of the input. In example 1 below,
acan be uniquely associated withc. But example 2, this is not possible because there are two final nodes that depend ona.
The following graphs illustrate how the rules interact in larger examples. In particular, it shows that dimensions are renamed to the ‘farthest away’ coordinate even if that is not a final result of the transformation.
In graph 1,
ais renamed tocbecause of rule 1.dis renamed tofbecause of the second part of rule 3.gcannot be renamed because rule 2 applies to its only child,h.In graph 2,
ais renamed tohbecausecandhcan be associated with each other through the cycle according to rule 4.This is no longer the case when
dis also a dimension-coordinate (graph 3). Like in example 1,ais renamed tocanddtof. Buthdepends onfdirectly andcthrough the cycle and can therefore not be associated with a single dimension.
More details on how the algorithm works and the rationale behind it can be found in Architecture Decision Record 0011.