tobac example: Tracking isolated convection based on updraft velocity and total condensate
This example notebook demonstrates the use of tobac to track isolated deep convective clouds in cloud-resolving model simulation output based on vertical velocity and total condensate mixing ratio.
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 libraries:
[1]:
# 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
[2]:
# Import tobac itself:
import tobac
[3]:
#Disable a couple of 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)
[4]:
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_W_mid_max = os.path.join(data_out,'*','data','Example_input_midlevelUpdraft.nc')
data_file_W_mid_max = glob(data_file_W_mid_max)[0]
data_file_TWC = os.path.join(data_out,'*','data','Example_input_Condensate.nc')
data_file_TWC = glob(data_file_TWC)[0]
[8]:
W_mid_max=xarray.open_dataset(data_file_W_mid_max)['w']
TWC=xarray.open_dataset(data_file_TWC)['twc']
[9]:
# Display information about the two cubes for vertical velocity and total condensate mixing ratio:
display(W_mid_max)
display(TWC)
- 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])
- bottom_top_stag()int64...
- bounds :
- bottom_top_stag_bnds
- units :
- 1
- long_name :
- bottom_top_stag
array(39)
- 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)
- model_level_number()int64...
- bounds :
- model_level_number_bnds
- units :
- 1
- standard_name :
- model_level_number
array(39)
- 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 :
- w
- units :
- m s-1
- cell_methods :
- model_level_number: maximum
- time: 47
- bottom_top: 94
- south_north: 198
- west_east: 198
- ...
[173203272 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]')
- bottom_top(bottom_top)int640 1 2 3 4 5 6 ... 88 89 90 91 92 93
- units :
- 1
- long_name :
- bottom_top
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93])
- 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)
- model_level_number(bottom_top)int64...
- units :
- 1
- standard_name :
- model_level_number
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93])
- 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 :
- TWC
- units :
- kg kg-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:
Perform feature detection based on midlevel maximum vertical velocity and a range of threshold values.
[11]:
# Determine temporal and spatial sampling of the input data:
dxy,dt=tobac.utils.get_spacings(W_mid_max)
[12]:
# Keyword arguments for feature detection step:
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']=[3,5,10] #m/s
parameters_features['n_erosion_threshold']=0
parameters_features['n_min_threshold']=3
[13]:
# Perform feature detection and save results:
print('start feature detection based on midlevel column maximum vertical velocity')
dxy,dt=tobac.utils.get_spacings(W_mid_max)
Features=tobac.themes.tobac_v1.feature_detection_multithreshold(W_mid_max,dxy,**parameters_features)
print('feature detection performed start saving features')
Features.to_netcdf(os.path.join(savedir,'Features.nc'))
print('features saved')
start feature detection based on midlevel column maximum vertical velocity
frame idx hdim_1 hdim_2 num threshold_value feature \
0 0 3 86.765659 53.350266 10 3 1
1 0 6 109.581883 65.230958 7 3 2
2 0 8 116.808699 191.185786 6 3 3
3 0 12 155.613171 33.200565 5 3 4
4 0 14 84.857363 37.092481 43 5 5
.. ... ... ... ... ... ... ...
624 46 36 144.848990 116.270462 51 10 625
625 46 38 158.442623 106.995282 6 10 626
626 46 39 172.189120 3.980561 53 10 627
627 46 40 186.763110 101.952079 17 10 628
628 46 41 190.393192 179.765727 4 10 629
time timestr south_north west_east \
0 2013-06-19 20:05:00 2013-06-19 20:05:00 367.765659 334.350266
1 2013-06-19 20:05:00 2013-06-19 20:05:00 390.581883 346.230958
2 2013-06-19 20:05:00 2013-06-19 20:05:00 397.808699 472.185786
3 2013-06-19 20:05:00 2013-06-19 20:05:00 436.613171 314.200565
4 2013-06-19 20:05:00 2013-06-19 20:05:00 365.857363 318.092481
.. ... ... ... ...
624 2013-06-19 23:55:00 2013-06-19 23:55:00 425.848990 397.270462
625 2013-06-19 23:55:00 2013-06-19 23:55:00 439.442623 387.995282
626 2013-06-19 23:55:00 2013-06-19 23:55:00 453.189120 284.980561
627 2013-06-19 23:55:00 2013-06-19 23:55:00 467.763110 382.952079
628 2013-06-19 23:55:00 2013-06-19 23:55:00 471.393192 460.765727
bottom_top_stag model_level_number projection_y_coordinate y \
0 334.350266 334.350266 184132.829257 367.765659
1 346.230958 346.230958 195540.941390 390.581883
2 472.185786 472.185786 199154.349360 397.808699
3 314.200565 314.200565 218556.585318 436.613171
4 318.092481 318.092481 183178.681637 365.857363
.. ... ... ... ...
624 397.270462 397.270462 213174.494771 425.848990
625 387.995282 387.995282 219971.311750 439.442623
626 284.980561 284.980561 226844.559837 453.189120
627 382.952079 382.952079 234131.555024 467.763110
628 460.765727 460.765727 235946.595843 471.393192
latitude longitude projection_x_coordinate \
0 [30.016038859108175] [-94.62685053589469] 167425.132894
1 [30.120045475411185] [-94.5637249988283] 173365.479208
2 [30.14916169399921] [-93.89838383702785] 236342.893153
3 [30.33071080683231] [-94.73227239126004] 157350.282423
4 [30.007544572713726] [-94.71261994128162] 159296.240490
.. ... ... ...
624 [30.279932206676968] [-94.29310184128425] 198885.230853
625 [30.342259128747088] [-94.34174723855492] 194247.641224
626 [30.40663218356964] [-94.88678519978228] 142740.280723
627 [30.471714442853838] [-94.36760066497843] 191726.039457
628 [30.485679966689368] [-93.95513846172912] 230632.863513
x
0 334.350266
1 346.230958
2 472.185786
3 314.200565
4 318.092481
.. ...
624 397.270462
625 387.995282
626 284.980561
627 382.952079
628 460.765727
[629 rows x 19 columns]
['time', 'south_north', 'west_east', 'bottom_top_stag', 'latitude', 'longitude', 'model_level_number', 'x', 'y', 'x_0', 'y_0']
feature detection performed start saving features
features saved
[14]:
parameters_segmentation_TWC={}
parameters_segmentation_TWC['method']='watershed'
parameters_segmentation_TWC['threshold']=0.1e-3 # kg/kg mixing ratio
[15]:
print('Start segmentation based on total water content')
Mask_TWC,Features_TWC=tobac.themes.tobac_v1.segmentation(Features,TWC,dxy,**parameters_segmentation_TWC)
print('segmentation TWC performed, start saving results to files')
Mask_TWC.to_netcdf(os.path.join(savedir,'Mask_Segmentation_TWC.nc'))
Features_TWC.to_netcdf(os.path.join(savedir,'Features_TWC.nc'))
print('segmentation TWC performed and saved')
Start segmentation based on total water content
<xarray.DataArray 'twc' (time: 47, bottom_top: 94, south_north: 198, west_east: 198)>
[173203272 values with dtype=float32]
Coordinates:
* time (time) datetime64[ns] 2013-06-19T20:05:00 ... 2013-06-19T23:55:00
* bottom_top (bottom_top) int64 0 1 2 3 4 5 6 ... 88 89 90 91 92 93
* south_north (south_north) int64 281 282 283 284 ... 475 476 477 478
* west_east (west_east) int64 281 282 283 284 ... 475 476 477 478
latitude (south_north, west_east) float32 29.62032 ... 30.515106
longitude (south_north, west_east) float32 -94.90857 ... -93.863464
model_level_number (bottom_top) int64 0 1 2 3 4 5 6 ... 88 89 90 91 92 93
x (west_east) float64 1.408e+05 1.412e+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 ... 475 476 477 478
y_0 (south_north) int64 281 282 283 284 ... 475 476 477 478
Attributes:
long_name: TWC
units: kg kg-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 TWC performed, start saving results to files
segmentation TWC performed and saved
[16]:
# Keyword arguments for 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 linking and save results:
Track=tobac.themes.tobac_v1.linking_trackpy(Features,W_mid_max,dt=dt,dxy=dxy,**parameters_linking)
Track.to_netcdf(os.path.join(savedir,'Track.nc'))
Frame 46: 18 trajectories present.
Visualisation:
[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)
[21]:
# Create animation showing tracked cells with outline of cloud volumes and the midlevel vertical velocity as a background field:
animation_tobac=tobac.plot.animation_mask_field(Track,Features,W_mid_max,Mask_TWC,
axis_extent=axis_extent,#figsize=figsize,orientation_colorbar='horizontal',pad_colorbar=0.2,
vmin=0,vmax=20,extend='both',cmap='Blues',
interval=500,figsize=(10,7),
plot_outline=True,plot_marker=True,marker_track='x',plot_number=True,plot_features=True)
[22]:
# Display animation:
from IPython.display import HTML, Image, display
HTML(animation_tobac.to_html5_video())
[22]:
[23]:
# # 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}')
[24]:
# Updraft lifetimes of tracked cells:
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')
[24]:
Text(0, 0.5, 'counts')