tams.run()#
tams.run() is a convenience function that does
aggregation and statistics
Using a selection of the example post-processed MPAS data, we investigate its outputs.
import xarray as xr
import tams
xr.set_options(display_expand_data=False)
tams.run() expects certain variable names.
ds = tams.data.open_example("mpas-regridded").rename({"tb": "ctt"}).isel(time=slice(1, 13))
ds
<xarray.Dataset> Size: 6MB
Dimensions: (time: 12, lat: 180, lon: 341)
Coordinates:
* time (time) datetime64[ns] 96B 2006-09-08T13:00:00 ... 2006-09-09
* lat (lat) float64 1kB -4.875 -4.625 -4.375 -4.125 ... 39.38 39.62 39.88
* lon (lon) float64 3kB 85.0 85.25 85.5 85.75 ... 169.2 169.5 169.8 170.0
Data variables:
ctt (time, lat, lon) float32 3MB ...
pr (time, lat, lon) float32 3MB ...tams.run() produces three output datasets.
%%time
ce, mcs, mcs_summary = tams.run(ds, parallel=True)
CE dataset#
Identified cloud elements (CEs). Tracking has added mcs_id; classification has added mcs_class.
Each row corresponds to a CE–time that belongs to an MCS. A certain MCS at a given time may include multiple CEs.
ce
| geometry | area_km2 | core | area_core_km2 | time | mcs_id | mcs_class | |
|---|---|---|---|---|---|---|---|
| 0 | POLYGON ((167.5 9.49188, 166.5 9.54, 166.07978... | 25634.1184 | POLYGON ((167.5 9.61125, 167.41158 9.625, 166.... | 11798.035271 | 2006-09-08 13:00:00 | 0 | DSL |
| 1 | POLYGON ((152.5 8.79886, 152.4243 8.875, 152.2... | 79372.537834 | MULTIPOLYGON (((152.25 9.23253, 152.16346 9.37... | 48340.476814 | 2006-09-08 13:00:00 | 1 | DSL |
| 2 | POLYGON ((148.75 8.23715, 148.50395 8.375, 148... | 14036.478097 | POLYGON ((148.75 8.34082, 148.68898 8.375, 148... | 7223.353767 | 2006-09-08 13:00:00 | 2 | DSL |
| 3 | POLYGON ((147.25 7.01224, 147 7.01659, 146.954... | 22263.09014 | POLYGON ((147.75 7.1996, 147.25 7.23491, 147.1... | 6159.967885 | 2006-09-08 13:00:00 | 3 | DSL |
| 4 | POLYGON ((138.25 15.00363, 138.04338 15.125, 1... | 10596.159009 | POLYGON ((138.25 15.10322, 138.21292 15.125, 1... | 5433.912228 | 2006-09-08 13:00:00 | 4 | DSL |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 261 | POLYGON ((117.25 13.78693, 117 13.81703, 115 1... | 155497.732041 | MULTIPOLYGON (((116.98605 14.125, 117.75 14.53... | 15771.546674 | 2006-09-09 00:00:00 | 57 | CCC |
| 262 | POLYGON ((111 2.19542, 109.91985 2.875, 109.75... | 264162.134187 | MULTIPOLYGON (((110.25 3.20253, 110.17251 3.37... | 80937.089703 | 2006-09-09 00:00:00 | 58 | CCC |
| 263 | POLYGON ((110.75 20.62436, 110.74361 20.625, 1... | 95355.10757 | MULTIPOLYGON (((111.5 20.85344, 111.30824 20.8... | 48925.646734 | 2006-09-09 00:00:00 | 97 | DSL |
| 264 | POLYGON ((101.75 17.48897, 101.5 17.59824, 101... | 296457.481388 | MULTIPOLYGON (((103.50533 18.625, 103.53368 19... | 97831.694327 | 2006-09-09 00:00:00 | 97 | DSL |
| 265 | POLYGON ((101.75 -1.71823, 101.25 -1.55739, 10... | 732976.336208 | MULTIPOLYGON (((99.32592 3.875, 99.25 4.11006,... | 427573.34013 | 2006-09-09 00:00:00 | 100 | DSL |
266 rows × 7 columns
ce.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
RangeIndex: 266 entries, 0 to 265
Data columns (total 7 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 geometry 266 non-null geometry
1 area_km2 266 non-null Float64
2 core 266 non-null geometry
3 area_core_km2 266 non-null Float64
4 time 266 non-null datetime64[ns]
5 mcs_id 266 non-null Int64
6 mcs_class 266 non-null category
dtypes: Float64(2), Int64(1), category(1), datetime64[ns](1), geometry(2)
memory usage: 13.8 KB
ce.area_km2.describe()
count 266.0
mean 299646.526759
std 435244.136045
min 10377.283677
25% 38009.793516
50% 138391.312977
75% 375933.734702
max 2801305.079679
Name: area_km2, dtype: Float64
MCS dataset#
At each time, CEs with the same MCS ID are combined into one.
Some statistics of precip (pr) and cloud-top temperature (ctt) within the MCS areas are included.
Each row corresponds to an MCS–time.
mcs
| time | geometry | core | nce | area_km2 | area_core_km2 | mcs_id | mcs_class | mean_pr | std_pr | npixel | mean_pr_core | std_pr_core | mean_ctt_core | std_ctt_core | npixel_core | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2006-09-08 13:00:00 | MULTIPOLYGON (((167.5 9.49188, 166.5 9.54, 166... | MULTIPOLYGON (((167.5 9.61125, 167.41158 9.625... | 1 | 25634.1184 | 11798.035271 | 0 | DSL | 2.645099 | 0.927722 | 36 | 3.28087 | 0.533223 | 209.896072 | 4.906273 | 18 |
| 1 | 2006-09-08 13:00:00 | MULTIPOLYGON (((152.5 8.79886, 152.4243 8.875,... | MULTIPOLYGON (((152.25 9.23253, 152.16346 9.37... | 1 | 79372.537834 | 48340.476814 | 1 | DSL | 1.910169 | 1.426157 | 106 | 2.547689 | 1.304625 | 215.991379 | 16.687454 | 64 |
| 2 | 2006-09-08 13:00:00 | MULTIPOLYGON (((148.75 8.23715, 148.50395 8.37... | MULTIPOLYGON (((148.75 8.34082, 148.68898 8.37... | 1 | 14036.478097 | 7223.353767 | 2 | DSL | 2.254961 | 0.982726 | 19 | 2.883151 | 0.706086 | 213.163315 | 4.442413 | 11 |
| 3 | 2006-09-08 13:00:00 | MULTIPOLYGON (((147.25 7.01224, 147 7.01659, 1... | MULTIPOLYGON (((147.75 7.1996, 147.25 7.23491,... | 1 | 22263.09014 | 6159.967885 | 3 | DSL | 2.019073 | 0.856571 | 29 | 2.915771 | 0.337212 | 214.483337 | 2.475573 | 9 |
| 4 | 2006-09-08 13:00:00 | MULTIPOLYGON (((138.25 15.00363, 138.04338 15.... | MULTIPOLYGON (((138.25 15.10322, 138.21292 15.... | 1 | 10596.159009 | 5433.912228 | 4 | DSL | 1.95028 | 0.935729 | 15 | 2.571446 | 0.641791 | 211.823792 | 5.197964 | 8 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 236 | 2006-09-09 00:00:00 | MULTIPOLYGON (((126 16.04305, 125.25 16.32695,... | MULTIPOLYGON (((125.25 18.29594, 125.06833 18.... | 4 | 963155.281892 | 326617.371325 | 97 | DSL | 0.951342 | 1.145551 | 1243 | 1.409412 | 1.486175 | 214.83139 | 6.734364 | 442 |
| 237 | 2006-09-09 00:00:00 | MULTIPOLYGON (((148.75 -2.21941, 147.5 -1.9227... | MULTIPOLYGON (((150.44311 -0.625, 150.5 -0.537... | 1 | 157397.412137 | 40993.731489 | 99 | DSL | 0.900998 | 0.597975 | 205 | 1.25952 | 0.619944 | 217.582062 | 4.004134 | 55 |
| 238 | 2006-09-09 00:00:00 | MULTIPOLYGON (((101.75 -1.71823, 101.25 -1.557... | MULTIPOLYGON (((99.32592 3.875, 99.25 4.11006,... | 1 | 732976.336208 | 427573.34013 | 100 | DSL | 0.769442 | 0.954339 | 947 | 1.12346 | 1.051847 | 217.626099 | 13.392982 | 558 |
| 239 | 2006-09-09 00:00:00 | MULTIPOLYGON (((155.5 -4.77577, 155 -4.77092, ... | MULTIPOLYGON (((153.5 -1.46794, 153.57218 -1.6... | 1 | 489014.692674 | 149373.297305 | 103 | DSL | 0.846575 | 0.948353 | 628 | 1.271607 | 1.048026 | 216.019394 | 4.94757 | 202 |
| 240 | 2006-09-09 00:00:00 | MULTIPOLYGON (((129.5 30.22046, 128.75 30.3713... | MULTIPOLYGON (((129.89756 30.375, 130 30.5994,... | 1 | 59910.587417 | 22585.544931 | 104 | DSL | 1.321026 | 0.87163 | 80 | 1.65364 | 0.771776 | 216.026505 | 7.512138 | 33 |
241 rows × 16 columns
mcs.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
RangeIndex: 241 entries, 0 to 240
Data columns (total 16 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 time 241 non-null datetime64[ns]
1 geometry 241 non-null geometry
2 core 241 non-null geometry
3 nce 241 non-null Int64
4 area_km2 241 non-null Float64
5 area_core_km2 241 non-null Float64
6 mcs_id 241 non-null Int64
7 mcs_class 241 non-null category
8 mean_pr 241 non-null Float64
9 std_pr 241 non-null Float64
10 npixel 241 non-null Int64
11 mean_pr_core 241 non-null Float64
12 std_pr_core 241 non-null Float64
13 mean_ctt_core 241 non-null Float64
14 std_ctt_core 241 non-null Float64
15 npixel_core 241 non-null Int64
dtypes: Float64(8), Int64(4), category(1), datetime64[ns](1), geometry(2)
memory usage: 31.6 KB
MCS summary dataset#
No more shapes (just first and last centroid points).
Each row corresponds to an MCS, including some statistics for the track such as the MCS’s duration and initial and final coordinates.
mcs_summary
| first_time | last_time | duration | mcs_id | mcs_class | mean_mean_pr | mean_mean_pr_core | mean_mean_ctt_core | mean_std_ctt_core | mean_area_km2 | mean_area_core_km2 | mean_nce | first_centroid | last_centroid | distance_km | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 0 | DSL | 2.645099 | 3.28087 | 209.896072 | 4.906273 | 25634.1184 | 11798.035271 | 1.0 | POINT (166.99291 10.21816) | POINT (166.99291 10.21816) | 0.0 |
| 1 | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 1 | DSL | 1.910169 | 2.547689 | 215.991379 | 16.687454 | 79372.537834 | 48340.476814 | 1.0 | POINT (152.90791 10.97758) | POINT (152.90791 10.97758) | 0.0 |
| 2 | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 2 | DSL | 2.254961 | 2.883151 | 213.163315 | 4.442413 | 14036.478097 | 7223.353767 | 1.0 | POINT (148.77232 8.90816) | POINT (148.77232 8.90816) | 0.0 |
| 3 | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 3 | DSL | 2.019073 | 2.915771 | 214.483337 | 2.475573 | 22263.09014 | 6159.967885 | 1.0 | POINT (147.51589 7.72076) | POINT (147.51589 7.72076) | 0.0 |
| 4 | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 4 | DSL | 1.95028 | 2.571446 | 211.823792 | 5.197964 | 10596.159009 | 5433.912228 | 1.0 | POINT (137.91402 15.61447) | POINT (137.91402 15.61447) | 0.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 100 | 2006-09-08 23:00:00 | 2006-09-09 00:00:00 | 0 days 02:00:00 | 100 | DSL | 0.811172 | 1.199069 | 216.89772 | 13.187364 | 731530.027472 | 413782.578921 | 1.0 | POINT (103.48369 2.7195) | POINT (103.56398 2.63599) | 12.896688 |
| 101 | 2006-09-08 23:00:00 | 2006-09-08 23:00:00 | 0 days 01:00:00 | 101 | DSL | 0.420176 | 0.500188 | 216.85463 | 1.26252 | 35653.26044 | 4362.490837 | 1.0 | POINT (101.19661 11.42259) | POINT (101.19661 11.42259) | 0.0 |
| 102 | 2006-09-08 23:00:00 | 2006-09-08 23:00:00 | 0 days 01:00:00 | 102 | DSL | 0.418313 | 0.44796 | 216.057571 | 2.313324 | 59905.773641 | 13963.960685 | 1.0 | POINT (96.17502 16.12416) | POINT (96.17502 16.12416) | 0.0 |
| 103 | 2006-09-09 00:00:00 | 2006-09-09 00:00:00 | 0 days 01:00:00 | 103 | DSL | 0.846575 | 1.271607 | 216.019394 | 4.94757 | 489014.692674 | 149373.297305 | 1.0 | POINT (155.5229 -0.60289) | POINT (155.5229 -0.60289) | 0.0 |
| 104 | 2006-09-09 00:00:00 | 2006-09-09 00:00:00 | 0 days 01:00:00 | 104 | DSL | 1.321026 | 1.65364 | 216.026505 | 7.512138 | 59910.587417 | 22585.544931 | 1.0 | POINT (129.22112 31.61942) | POINT (129.22112 31.61942) | 0.0 |
105 rows × 15 columns
mcs_summary.info()
<class 'geopandas.geodataframe.GeoDataFrame'>
RangeIndex: 105 entries, 0 to 104
Data columns (total 15 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 first_time 105 non-null datetime64[ns]
1 last_time 105 non-null datetime64[ns]
2 duration 105 non-null timedelta64[ns]
3 mcs_id 105 non-null Int64
4 mcs_class 105 non-null category
5 mean_mean_pr 105 non-null Float64
6 mean_mean_pr_core 105 non-null Float64
7 mean_mean_ctt_core 105 non-null Float64
8 mean_std_ctt_core 105 non-null Float64
9 mean_area_km2 105 non-null Float64
10 mean_area_core_km2 105 non-null Float64
11 mean_nce 105 non-null Float64
12 first_centroid 105 non-null geometry
13 last_centroid 105 non-null geometry
14 distance_km 105 non-null Float64
dtypes: Float64(8), Int64(1), category(1), datetime64[ns](2), geometry(2), timedelta64[ns](1)
memory usage: 12.8 KB
mcs_summary.describe()
| first_time | last_time | duration | mcs_id | mean_mean_pr | mean_mean_pr_core | mean_mean_ctt_core | mean_std_ctt_core | mean_area_km2 | mean_area_core_km2 | mean_nce | distance_km | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | 105 | 105 | 105 | 105.0 | 105.0 | 105.0 | 105.0 | 105.0 | 105.0 | 105.0 | 105.0 | 105.0 |
| mean | 2006-09-08 16:31:25.714285824 | 2006-09-08 17:49:08.571428608 | 0 days 02:17:42.857142857 | 52.0 | 1.138997 | 1.590076 | 213.928635 | 6.939896 | 194988.950333 | 79454.696398 | 1.049501 | 51.122709 |
| min | 2006-09-08 13:00:00 | 2006-09-08 13:00:00 | 0 days 01:00:00 | 0.0 | 0.187491 | 0.44796 | 205.555122 | 0.343413 | 10596.159009 | 4362.490837 | 1.0 | 0.0 |
| 25% | 2006-09-08 14:00:00 | 2006-09-08 15:00:00 | 0 days 01:00:00 | 26.0 | 0.770348 | 1.062927 | 211.345551 | 3.913308 | 27856.409327 | 9287.723999 | 1.0 | 0.0 |
| 50% | 2006-09-08 16:00:00 | 2006-09-08 16:00:00 | 0 days 01:00:00 | 52.0 | 1.063115 | 1.36649 | 214.644318 | 6.444789 | 63671.779856 | 17972.930837 | 1.0 | 0.0 |
| 75% | 2006-09-08 18:00:00 | 2006-09-08 21:00:00 | 0 days 03:00:00 | 78.0 | 1.407423 | 1.845998 | 216.561127 | 9.052417 | 197646.566652 | 76259.805545 | 1.0 | 45.682202 |
| max | 2006-09-09 00:00:00 | 2006-09-09 00:00:00 | 0 days 10:00:00 | 104.0 | 3.069273 | 6.575438 | 222.615143 | 20.648977 | 1782531.771679 | 808963.602143 | 2.666667 | 750.167907 |
| std | NaN | NaN | 0 days 02:11:00.676927481 | 30.454885 | 0.542146 | 0.86736 | 3.482926 | 4.062472 | 328631.541102 | 139784.626896 | 0.205075 | 116.360032 |