tobac example: Tracking of precipitation features
This example notebook demonstrates the use of tobac to track precipitation features from isolated deep convective clouds.
The simulation results used in this example were performed as part of the ACPC deep convection intercomparison case study (http://acpcinitiative.org/Docs/ACPC_DCC_Roadmap_171019.pdf) with WRF using the Morrison microphysics scheme.
The data used in this example is downloaded from “zenodo link” automatically as part of the notebooks (This only has to be done once for all the tobac example notebooks).
Import necessary python libraries:
[1]:
### a development hack
### !pip install --upgrade ../../../../tobac/
[2]:
# Import libraries:
import xarray
import numpy as np
import pandas as pd
import os
from six.moves import urllib
from glob import glob
import matplotlib.pyplot as plt
%matplotlib inline
[3]:
# Import tobac itself
import tobac
[4]:
# Disable a few warnings:
import warnings
warnings.filterwarnings('ignore', category=UserWarning, append=True)
warnings.filterwarnings('ignore', category=RuntimeWarning, append=True)
warnings.filterwarnings('ignore', category=FutureWarning, append=True)
warnings.filterwarnings('ignore',category=pd.io.pytables.PerformanceWarning)
Download example data:
Actual download has to be performed only once for all example notebooks!
[5]:
data_out='../'
[6]:
# # Download the data: This only has to be done once for all tobac examples and can take a while
# file_path='https://zenodo.org/record/3195910/files/climate-processes/tobac_example_data-v1.0.1.zip'
# #file_path='http://zenodo..'
# tempfile='temp.zip'
# print('start downloading data')
# request=urllib.request.urlretrieve(file_path,tempfile)
# print('start extracting data')
# shutil.unpack_archive(tempfile,data_out)
# #zf = zipfile.ZipFile(tempfile)
# #zf.extractall(data_out)
# os.remove(tempfile)
# print('data extracted')
Load Data from downloaded file:
[7]:
data_file = os.path.join(data_out,'*','data','Example_input_Precip.nc')
data_file = glob(data_file)[0]
[8]:
Precip=xarray.open_dataset(data_file)['surface_precipitation_average']
[9]:
#display information about the iris cube containing the surface precipitation data:
display(Precip)
- time: 47
- south_north: 198
- west_east: 198
- ...
[1842588 values with dtype=float32]
- time(time)datetime64[ns]2013-06-19T20:05:00 ... 2013-06-19T23:55:00
- axis :
- T
- standard_name :
- time
array(['2013-06-19T20:05:00.000000000', '2013-06-19T20:10:00.000000000', '2013-06-19T20:15:00.000000000', '2013-06-19T20:20:00.000000000', '2013-06-19T20:25:00.000000000', '2013-06-19T20:30:00.000000000', '2013-06-19T20:35:00.000000000', '2013-06-19T20:40:00.000000000', '2013-06-19T20:45:00.000000000', '2013-06-19T20:50:00.000000000', '2013-06-19T20:55:00.000000000', '2013-06-19T21:00:00.000000000', '2013-06-19T21:05:00.000000000', '2013-06-19T21:10:00.000000000', '2013-06-19T21:15:00.000000000', '2013-06-19T21:20:00.000000000', '2013-06-19T21:25:00.000000000', '2013-06-19T21:30:00.000000000', '2013-06-19T21:35:00.000000000', '2013-06-19T21:40:00.000000000', '2013-06-19T21:45:00.000000000', '2013-06-19T21:50:00.000000000', '2013-06-19T21:55:00.000000000', '2013-06-19T22:00:00.000000000', '2013-06-19T22:05:00.000000000', '2013-06-19T22:10:00.000000000', '2013-06-19T22:15:00.000000000', '2013-06-19T22:20:00.000000000', '2013-06-19T22:25:00.000000000', '2013-06-19T22:30:00.000000000', '2013-06-19T22:35:00.000000000', '2013-06-19T22:40:00.000000000', '2013-06-19T22:45:00.000000000', '2013-06-19T22:50:00.000000000', '2013-06-19T22:55:00.000000000', '2013-06-19T23:00:00.000000000', '2013-06-19T23:05:00.000000000', '2013-06-19T23:10:00.000000000', '2013-06-19T23:15:00.000000000', '2013-06-19T23:20:00.000000000', '2013-06-19T23:25:00.000000000', '2013-06-19T23:30:00.000000000', '2013-06-19T23:35:00.000000000', '2013-06-19T23:40:00.000000000', '2013-06-19T23:45:00.000000000', '2013-06-19T23:50:00.000000000', '2013-06-19T23:55:00.000000000'], dtype='datetime64[ns]')
- south_north(south_north)int64281 282 283 284 ... 475 476 477 478
- units :
- 1
- long_name :
- south_north
array([281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478])
- west_east(west_east)int64281 282 283 284 ... 475 476 477 478
- units :
- 1
- long_name :
- west_east
array([281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478])
- latitude(south_north, west_east)float32...
- units :
- degrees_north
- standard_name :
- latitude
- FieldType :
- 104
- MemoryOrder :
- XY
- description :
- LATITUDE, SOUTH IS NEGATIVE
- stagger :
array([[29.62032 , 29.620296, 29.620296, ..., 29.615593, 29.615551, 29.615501], [29.624874, 29.624874, 29.624859, ..., 29.620167, 29.620113, 29.620071], [29.629444, 29.629429, 29.629429, ..., 29.624718, 29.624683, 29.624634], ..., [30.510818, 30.51081 , 30.51081 , ..., 30.506065, 30.506023, 30.505974], [30.515388, 30.51538 , 30.51538 , ..., 30.510628, 30.510586, 30.510536], [30.519962, 30.51995 , 30.519936, ..., 30.515198, 30.51514 , 30.515106]], dtype=float32)
- longitude(south_north, west_east)float32...
- units :
- degrees_east
- standard_name :
- longitude
- FieldType :
- 104
- MemoryOrder :
- XY
- description :
- LONGITUDE, WEST IS NEGATIVE
- stagger :
array([[-94.90857 , -94.90332 , -94.89807 , ..., -93.88428 , -93.87903 , -93.87378 ], [-94.90857 , -94.90332 , -94.89807 , ..., -93.88422 , -93.87897 , -93.87372 ], [-94.90857 , -94.90332 , -94.89807 , ..., -93.884186, -93.87894 , -93.87366 ], ..., [-94.907776, -94.902466, -94.897156, ..., -93.874176, -93.868866, -93.86359 ], [-94.907745, -94.902466, -94.897156, ..., -93.874115, -93.868805, -93.863525], [-94.907745, -94.902466, -94.897156, ..., -93.874054, -93.868774, -93.863464]], dtype=float32)
- x(west_east)float64...
- bounds :
- x_bnds
- units :
- m
- standard_name :
- projection_x_coordinate
- long_name :
- x
array([140750., 141250., 141750., 142250., 142750., 143250., 143750., 144250., 144750., 145250., 145750., 146250., 146750., 147250., 147750., 148250., 148750., 149250., 149750., 150250., 150750., 151250., 151750., 152250., 152750., 153250., 153750., 154250., 154750., 155250., 155750., 156250., 156750., 157250., 157750., 158250., 158750., 159250., 159750., 160250., 160750., 161250., 161750., 162250., 162750., 163250., 163750., 164250., 164750., 165250., 165750., 166250., 166750., 167250., 167750., 168250., 168750., 169250., 169750., 170250., 170750., 171250., 171750., 172250., 172750., 173250., 173750., 174250., 174750., 175250., 175750., 176250., 176750., 177250., 177750., 178250., 178750., 179250., 179750., 180250., 180750., 181250., 181750., 182250., 182750., 183250., 183750., 184250., 184750., 185250., 185750., 186250., 186750., 187250., 187750., 188250., 188750., 189250., 189750., 190250., 190750., 191250., 191750., 192250., 192750., 193250., 193750., 194250., 194750., 195250., 195750., 196250., 196750., 197250., 197750., 198250., 198750., 199250., 199750., 200250., 200750., 201250., 201750., 202250., 202750., 203250., 203750., 204250., 204750., 205250., 205750., 206250., 206750., 207250., 207750., 208250., 208750., 209250., 209750., 210250., 210750., 211250., 211750., 212250., 212750., 213250., 213750., 214250., 214750., 215250., 215750., 216250., 216750., 217250., 217750., 218250., 218750., 219250., 219750., 220250., 220750., 221250., 221750., 222250., 222750., 223250., 223750., 224250., 224750., 225250., 225750., 226250., 226750., 227250., 227750., 228250., 228750., 229250., 229750., 230250., 230750., 231250., 231750., 232250., 232750., 233250., 233750., 234250., 234750., 235250., 235750., 236250., 236750., 237250., 237750., 238250., 238750., 239250.])
- y(south_north)float64...
- bounds :
- y_bnds
- units :
- m
- standard_name :
- projection_y_coordinate
- long_name :
- y
array([140750., 141250., 141750., 142250., 142750., 143250., 143750., 144250., 144750., 145250., 145750., 146250., 146750., 147250., 147750., 148250., 148750., 149250., 149750., 150250., 150750., 151250., 151750., 152250., 152750., 153250., 153750., 154250., 154750., 155250., 155750., 156250., 156750., 157250., 157750., 158250., 158750., 159250., 159750., 160250., 160750., 161250., 161750., 162250., 162750., 163250., 163750., 164250., 164750., 165250., 165750., 166250., 166750., 167250., 167750., 168250., 168750., 169250., 169750., 170250., 170750., 171250., 171750., 172250., 172750., 173250., 173750., 174250., 174750., 175250., 175750., 176250., 176750., 177250., 177750., 178250., 178750., 179250., 179750., 180250., 180750., 181250., 181750., 182250., 182750., 183250., 183750., 184250., 184750., 185250., 185750., 186250., 186750., 187250., 187750., 188250., 188750., 189250., 189750., 190250., 190750., 191250., 191750., 192250., 192750., 193250., 193750., 194250., 194750., 195250., 195750., 196250., 196750., 197250., 197750., 198250., 198750., 199250., 199750., 200250., 200750., 201250., 201750., 202250., 202750., 203250., 203750., 204250., 204750., 205250., 205750., 206250., 206750., 207250., 207750., 208250., 208750., 209250., 209750., 210250., 210750., 211250., 211750., 212250., 212750., 213250., 213750., 214250., 214750., 215250., 215750., 216250., 216750., 217250., 217750., 218250., 218750., 219250., 219750., 220250., 220750., 221250., 221750., 222250., 222750., 223250., 223750., 224250., 224750., 225250., 225750., 226250., 226750., 227250., 227750., 228250., 228750., 229250., 229750., 230250., 230750., 231250., 231750., 232250., 232750., 233250., 233750., 234250., 234750., 235250., 235750., 236250., 236750., 237250., 237750., 238250., 238750., 239250.])
- x_0(west_east)int64...
- units :
- 1
- long_name :
- x
array([281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478])
- y_0(south_north)int64...
- units :
- 1
- long_name :
- y
array([281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478])
- long_name :
- surface_precipitation_average
- units :
- mm h-1
[10]:
#Set up directory to save output and plots:
savedir='Save'
if not os.path.exists(savedir):
os.makedirs(savedir)
plot_dir="Plot"
if not os.path.exists(plot_dir):
os.makedirs(plot_dir)
Feature detection:
Feature detection is perfomed based on surface precipitation field and a range of thresholds
[11]:
# Dictionary containing keyword options (could also be directly given to the function)
parameters_features={}
parameters_features['position_threshold']='weighted_diff'
parameters_features['sigma_threshold']=0.5
parameters_features['min_num']=3
parameters_features['min_distance']=0
parameters_features['sigma_threshold']=1
parameters_features['threshold']=[1,2,3,4,5,10,15] #mm/h
parameters_features['n_erosion_threshold']=0
parameters_features['n_min_threshold']=3
[12]:
# get temporal and spation resolution of the data
dxy,dt=tobac.utils.get_spacings(Precip)
[13]:
# Feature detection based on based on surface precipitation field and a range of thresholds
print('starting feature detection based on multiple thresholds')
Features=tobac.themes.tobac_v1.feature_detection_multithreshold(Precip,dxy,**parameters_features)
print('feature detection done')
Features.to_netcdf(os.path.join(savedir,'Features.nc'))
print('features saved')
starting feature detection based on multiple thresholds
frame idx hdim_1 hdim_2 num threshold_value feature \
0 0 1 50.065727 139.857477 9 1 1
1 0 15 120.527119 172.500325 4 1 2
2 0 18 126.779273 145.368401 15 1 3
3 0 34 111.611369 155.452030 4 2 4
4 0 35 111.765231 164.938866 8 2 5
... ... ... ... ... ... ... ...
1124 46 90 163.334480 35.049366 47 15 1125
1125 46 91 177.119093 1.938903 50 15 1126
1126 46 92 183.889436 100.054108 36 15 1127
1127 46 93 196.870749 177.405664 10 15 1128
1128 46 94 196.936190 191.649040 4 15 1129
time timestr south_north west_east \
0 2013-06-19 20:05:00 2013-06-19 20:05:00 331.065727 420.857477
1 2013-06-19 20:05:00 2013-06-19 20:05:00 401.527119 453.500325
2 2013-06-19 20:05:00 2013-06-19 20:05:00 407.779273 426.368401
3 2013-06-19 20:05:00 2013-06-19 20:05:00 392.611369 436.452030
4 2013-06-19 20:05:00 2013-06-19 20:05:00 392.765231 445.938866
... ... ... ... ...
1124 2013-06-19 23:55:00 2013-06-19 23:55:00 444.334480 316.049366
1125 2013-06-19 23:55:00 2013-06-19 23:55:00 458.119093 282.938903
1126 2013-06-19 23:55:00 2013-06-19 23:55:00 464.889436 381.054108
1127 2013-06-19 23:55:00 2013-06-19 23:55:00 477.870749 458.405664
1128 2013-06-19 23:55:00 2013-06-19 23:55:00 477.936190 472.649040
projection_y_coordinate y latitude \
0 165782.863285 331.065727 [29.84636174574229]
1 201013.559414 401.527119 [30.16692908466767]
2 204139.636582 407.779273 [30.196498834397495]
3 196555.684682 392.611369 [30.126870992779423]
4 196632.615461 392.765231 [30.127221395688906]
... ... ... ...
1124 222417.240247 444.334480 [30.36594369270744]
1125 229309.546339 458.119093 [30.42915134198937]
1126 232694.717873 464.889436 [30.45864828495059]
1127 239185.374437 477.870749 [30.515366411726458]
1128 239218.094905 477.936190 [30.515049777191315]
longitude projection_x_coordinate x
0 [-94.17201509872564] 210678.738492 420.857477
1 [-93.99689187482306] 227000.162468 453.500325
2 [-94.13995972549196] 213434.200454 426.368401
3 [-94.08731650871061] 218476.015240 436.452030
4 [-94.03722567369418] 223219.433218 445.938866
... ... ... ...
1124 [-94.722384409394] 158274.683059 316.049366
1125 [-94.89756987871436] 141719.451486 282.938903
1126 [-94.3777372958404] 190777.054179 381.054108
1127 [-93.96733386588102] 229452.832088 458.405664
1128 [-93.89182112542963] 236574.520064 472.649040
[1129 rows x 17 columns]
['time', 'south_north', 'west_east', 'latitude', 'longitude', 'x', 'y', 'x_0', 'y_0']
feature detection done
features saved
Segmentation:
Segmentation is performed based on a watershedding and a threshold value:
[14]:
# Dictionary containing keyword arguments for segmentation step:
parameters_segmentation={}
parameters_segmentation['method']='watershed'
parameters_segmentation['threshold']=1 # mm/h mixing ratio
[15]:
# Perform Segmentation and save resulting mask to NetCDF file:
print('Starting segmentation based on surface precipitation')
Mask,Features_Precip=tobac.themes.tobac_v1.segmentation(Features,Precip,dxy,**parameters_segmentation)
print('segmentation based on surface precipitation performed, start saving results to files')
Mask.to_netcdf(os.path.join(savedir,'Mask_Segmentation_precip.nc'))
Features_Precip.to_netcdf(os.path.join(savedir,'Features_Precip.nc'))
print('segmentation surface precipitation performed and saved')
Starting segmentation based on surface precipitation
<xarray.DataArray 'surface_precipitation_average' (time: 47, south_north: 198, west_east: 198)>
array([[[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
...,
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00]],
[[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
...,
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00],
[0.000000e+00, 0.000000e+00, ..., 0.000000e+00, 0.000000e+00]],
...,
[[1.162095e-03, 1.237040e-03, ..., 0.000000e+00, 0.000000e+00],
[1.077846e-03, 1.167705e-03, ..., 0.000000e+00, 0.000000e+00],
...,
[0.000000e+00, 0.000000e+00, ..., 1.475261e-01, 7.602954e-02],
[0.000000e+00, 0.000000e+00, ..., 1.065946e-01, 4.400021e-02]],
[[3.334880e-05, 2.312288e-05, ..., 0.000000e+00, 0.000000e+00],
[1.528859e-05, 8.571893e-06, ..., 0.000000e+00, 0.000000e+00],
...,
[6.988572e-03, 1.184124e-03, ..., 1.278359e-01, 2.074599e-02],
[3.475464e-04, 2.722412e-05, ..., 1.691269e-01, 1.051712e-02]]],
dtype=float32)
Coordinates:
* time (time) datetime64[ns] 2013-06-19T20:05:00 ... 2013-06-19T23:55:00
* south_north (south_north) int64 281 282 283 284 285 ... 474 475 476 477 478
* west_east (west_east) int64 281 282 283 284 285 ... 474 475 476 477 478
latitude (south_north, west_east) float32 29.62032 ... 30.515106
longitude (south_north, west_east) float32 -94.90857 ... -93.863464
x (west_east) float64 1.408e+05 1.412e+05 ... 2.388e+05 2.392e+05
y (south_north) float64 1.408e+05 1.412e+05 ... 2.392e+05
x_0 (west_east) int64 281 282 283 284 285 ... 474 475 476 477 478
y_0 (south_north) int64 281 282 283 284 285 ... 474 475 476 477 478
Attributes:
long_name: surface_precipitation_average
units: mm h-1
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
/home/senf/TROPOS/tmp/tobac-dev-2020-07-09/test-env/lib/python3.7/site-packages/skimage/morphology/_deprecated.py:5: skimage_deprecation: Function ``watershed`` is deprecated and will be removed in version 0.19. Use ``skimage.segmentation.watershed`` instead.
def watershed(image, markers=None, connectivity=1, offset=None, mask=None,
segmentation based on surface precipitation performed, start saving results to files
segmentation surface precipitation performed and saved
Trajectory linking:
Trajectory linking is performed using the trackpy library (http://soft-matter.github.io/trackpy). This takes the feature positions determined in the feature detection step into account but does not include information on the shape of the identified objects.
[16]:
# Dictionary containing keyword arguments for the linking step:
parameters_linking={}
parameters_linking['method_linking']='predict'
parameters_linking['adaptive_stop']=0.2
parameters_linking['adaptive_step']=0.95
parameters_linking['extrapolate']=0
parameters_linking['order']=1
parameters_linking['subnetwork_size']=100
parameters_linking['memory']=0
parameters_linking['time_cell_min']=5*60
parameters_linking['method_linking']='predict'
parameters_linking['v_max']=10
parameters_linking['d_min']=2000
[17]:
# Perform trajectory linking using trackpy and save the resulting DataFrame:
Track=tobac.themes.tobac_v1.linking_trackpy(Features,Precip,dt=dt,dxy=dxy,**parameters_linking)
Track.to_netcdf(os.path.join(savedir,'Track.nc'))
Frame 46: 18 trajectories present.
Visualistation:
[18]:
# Set extent for maps plotted in the following cells ( in the form [lon_min,lon_max,lat_min,lat_max])
axis_extent=[-95,-93.8,29.5,30.6]
[19]:
# Plot map with all individual tracks:
import cartopy.crs as ccrs
fig_map,ax_map=plt.subplots(figsize=(10,10),subplot_kw={'projection': ccrs.PlateCarree()})
ax_map=tobac.plot.map_tracks(Track,axis_extent=axis_extent,axes=ax_map)
[20]:
# Create animation showing tracked cells with outline of precipitation features and the and surface precipitation as a background field:
animation_tobac=tobac.plot.animation_mask_field(Track, Features, Precip, Mask,
axis_extent=axis_extent,#figsize=figsize,orientation_colorbar='horizontal',pad_colorbar=0.2,
vmin=0,vmax=60,extend='both',cmap='Blues',
interval=500,figsize=(10,10),
plot_outline=True,plot_marker=True,marker_track='x',plot_number=True,plot_features=True);
[21]:
# Display animation:
from IPython.display import HTML, Image, display
HTML(animation_tobac.to_html5_video())
[21]:
[22]:
# # Save animation to file
# savefile_animation=os.path.join(plot_dir,'Animation.mp4')
# animation_tobac.save(savefile_animation,dpi=200)
# print(f'animation saved to {savefile_animation}')
[23]:
# Lifetimes of tracked features:
fig_lifetime,ax_lifetime=plt.subplots()
tobac.plot.plot_lifetime_histogram_bar(Track,axes=ax_lifetime,bin_edges=np.arange(0,120,10),density=False,width_bar=8)
ax_lifetime.set_xlabel('lifetime (min)')
ax_lifetime.set_ylabel('counts')
[23]:
Text(0, 0.5, 'counts')