{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "(nb_testing_metpy)=\n", "# Getting started with MetPy\n", "\n", "Before we get started, we test the learning environment and the most important packages needed to run the notebooks. This is not so much a continuous coherent exercise as individual examples based on the different packages.This exercise is neither an introduction to Python nor extensive tutorials for the individual packages. I advise you, if you have little or no experience with the packages, to work through the relevant tutorial on the websites. All packages offer very good and extensive tutorials. Most of the functions presented here have been taken from these websites." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Magnitude | [0.5 0.5 0.5 0.5] |
---|---|
Units | meter/second |
<xarray.Dataset>\n", "Dimensions: (time1: 9, latitude: 81,\n", " isobaric3: 31, isobaric1: 21,\n", " longitude: 131)\n", "Coordinates:\n", " * time1 (time1) datetime64[ns] 2017-09-05T12...\n", " reftime datetime64[ns] ...\n", " * latitude (latitude) float32 50.0 49.5 ... 10.0\n", " * isobaric3 (isobaric3) float64 100.0 ... 1e+05\n", " * isobaric1 (isobaric1) float64 1e+04 ... 1e+05\n", " * longitude (longitude) float32 250.0 ... 315.0\n", "Data variables:\n", " Vertical_velocity_pressure_isobaric (time1, isobaric1, latitude, longitude) float32 ...\n", " Relative_humidity_isobaric (time1, isobaric3, latitude, longitude) float32 ...\n", " Temperature_isobaric (time1, isobaric3, latitude, longitude) float32 ...\n", " u-component_of_wind_isobaric (time1, isobaric3, latitude, longitude) float32 ...\n", " v-component_of_wind_isobaric (time1, isobaric3, latitude, longitude) float32 ...\n", " Geopotential_height_isobaric (time1, isobaric3, latitude, longitude) float32 ...\n", " LatLon_361X720-0p25S-180p00E int32 ...\n", "Attributes: (12/13)\n", " Originating_or_generating_Center: ...\n", " Originating_or_generating_Subcenter: ...\n", " GRIB_table_version: ...\n", " Type_of_generating_process: ...\n", " Analysis_or_forecast_generating_process_identifier_defined_by_originating...\n", " Conventions: ...\n", " ... ...\n", " featureType: ...\n", " History: ...\n", " geospatial_lat_min: ...\n", " geospatial_lat_max: ...\n", " geospatial_lon_min: ...\n", " geospatial_lon_max: ...
<xarray.DataArray 'Temperature_isobaric' (time1: 9, isobaric3: 31,\n", " latitude: 81, longitude: 131)>\n", "[2960469 values with dtype=float32]\n", "Coordinates:\n", " * time1 (time1) datetime64[ns] 2017-09-05T12:00:00 ... 2017-09-06T12:0...\n", " reftime datetime64[ns] ...\n", " * latitude (latitude) float32 50.0 49.5 49.0 48.5 ... 11.5 11.0 10.5 10.0\n", " * isobaric3 (isobaric3) float64 100.0 200.0 300.0 ... 9.5e+04 9.75e+04 1e+05\n", " * longitude (longitude) float32 250.0 250.5 251.0 251.5 ... 314.0 314.5 315.0\n", "Attributes:\n", " long_name: Temperature @ Isobaric surface\n", " units: K\n", " Grib_Variable_Id: VAR_0-0-0_L100\n", " Grib2_Parameter: [0 0 0]\n", " Grib2_Parameter_Discipline: Meteorological products\n", " Grib2_Parameter_Category: Temperature\n", " Grib2_Parameter_Name: Temperature\n", " Grib2_Level_Type: 100\n", " Grib2_Level_Desc: Isobaric surface\n", " Grib2_Generating_Process_Type: Forecast\n", " grid_mapping: LatLon_361X720-0p25S-180p00E
<xarray.DataArray 'time1' (time1: 9)>\n", "array(['2017-09-05T12:00:00.000000000', '2017-09-05T15:00:00.000000000',\n", " '2017-09-05T18:00:00.000000000', '2017-09-05T21:00:00.000000000',\n", " '2017-09-06T00:00:00.000000000', '2017-09-06T03:00:00.000000000',\n", " '2017-09-06T06:00:00.000000000', '2017-09-06T09:00:00.000000000',\n", " '2017-09-06T12:00:00.000000000'], dtype='datetime64[ns]')\n", "Coordinates:\n", " * time1 (time1) datetime64[ns] 2017-09-05T12:00:00 ... 2017-09-06T12:00:00\n", " reftime datetime64[ns] ...\n", "Attributes:\n", " standard_name: time\n", " long_name: time\n", " udunits: Hour since 2017-09-05T12:00:00Z\n", " _metpy_axis: time
<xarray.DataArray 'longitude' (longitude: 131)>\n", "array([250. , 250.5, 251. , 251.5, 252. , 252.5, 253. , 253.5, 254. , 254.5,\n", " 255. , 255.5, 256. , 256.5, 257. , 257.5, 258. , 258.5, 259. , 259.5,\n", " 260. , 260.5, 261. , 261.5, 262. , 262.5, 263. , 263.5, 264. , 264.5,\n", " 265. , 265.5, 266. , 266.5, 267. , 267.5, 268. , 268.5, 269. , 269.5,\n", " 270. , 270.5, 271. , 271.5, 272. , 272.5, 273. , 273.5, 274. , 274.5,\n", " 275. , 275.5, 276. , 276.5, 277. , 277.5, 278. , 278.5, 279. , 279.5,\n", " 280. , 280.5, 281. , 281.5, 282. , 282.5, 283. , 283.5, 284. , 284.5,\n", " 285. , 285.5, 286. , 286.5, 287. , 287.5, 288. , 288.5, 289. , 289.5,\n", " 290. , 290.5, 291. , 291.5, 292. , 292.5, 293. , 293.5, 294. , 294.5,\n", " 295. , 295.5, 296. , 296.5, 297. , 297.5, 298. , 298.5, 299. , 299.5,\n", " 300. , 300.5, 301. , 301.5, 302. , 302.5, 303. , 303.5, 304. , 304.5,\n", " 305. , 305.5, 306. , 306.5, 307. , 307.5, 308. , 308.5, 309. , 309.5,\n", " 310. , 310.5, 311. , 311.5, 312. , 312.5, 313. , 313.5, 314. , 314.5,\n", " 315. ], dtype=float32)\n", "Coordinates:\n", " reftime datetime64[ns] ...\n", " * longitude (longitude) float32 250.0 250.5 251.0 251.5 ... 314.0 314.5 315.0\n", "Attributes:\n", " units: degrees_east\n", " standard_name: longitude\n", " _metpy_axis: x,longitude
<xarray.DataArray 'Geopotential_height_isobaric' (latitude: 81, longitude: 131)>\n", "[10611 values with dtype=float32]\n", "Coordinates:\n", " time1 datetime64[ns] 2017-09-05T18:00:00\n", " reftime datetime64[ns] ...\n", " * latitude (latitude) float32 50.0 49.5 49.0 48.5 ... 11.5 11.0 10.5 10.0\n", " isobaric3 float64 5e+04\n", " * longitude (longitude) float32 250.0 250.5 251.0 251.5 ... 314.0 314.5 315.0\n", "Attributes:\n", " long_name: Geopotential height @ Isobaric surface\n", " units: gpm\n", " Grib_Variable_Id: VAR_0-3-5_L100\n", " Grib2_Parameter: [0 3 5]\n", " Grib2_Parameter_Discipline: Meteorological products\n", " Grib2_Parameter_Category: Mass\n", " Grib2_Parameter_Name: Geopotential height\n", " Grib2_Level_Type: 100\n", " Grib2_Level_Desc: Isobaric surface\n", " Grib2_Generating_Process_Type: Forecast\n", " grid_mapping: LatLon_361X720-0p25S-180p00E
<cartopy.crs.PlateCarree object at 0x16dcd7f10>" ], "text/plain": [ "
<xarray.DataArray 'Temperature_isobaric' (time1: 9, isobaric3: 31,\n", " latitude: 81, longitude: 131)>\n", "<Quantity([[[[258. 258. 257.9 ... 258.2 258.2 258.3 ]\n", " [257.9 257.9 257.8 ... 258.2 258.2 258.2 ]\n", " [257.8 257.8 257.8 ... 258.1 258.1 258.1 ]\n", " ...\n", " [260.8 260.8 260.8 ... 258. 258.1 258.2 ]\n", " [261. 261. 261. ... 258.1 258.1 258.2 ]\n", " [261.2 261.2 261.2 ... 258.1 258.2 258.3 ]]\n", "\n", " [[256.5 256.5 256.5 ... 255.6 255.6 255.5 ]\n", " [256.4 256.4 256.3 ... 255.5 255.5 255.5 ]\n", " [256.2 256.2 256.2 ... 255.4 255.4 255.4 ]\n", " ...\n", " [259.1 259.1 259.1 ... 261.1 261.4 261.6 ]\n", " [259.2 259.2 259.2 ... 261.1 261.4 261.6 ]\n", " [259.4 259.3 259.3 ... 261.1 261.4 261.6 ]]\n", "\n", " [[251.4 251.4 251.4 ... 250.5 250.5 250.5 ]\n", " [251.2 251.3 251.3 ... 250.4 250.4 250.4 ]\n", " [251.1 251.1 251.1 ... 250.3 250.3 250.2 ]\n", " ...\n", "...\n", " ...\n", " [295.40698 295.40698 295.40698 ... 295.70697 295.70697 295.507 ]\n", " [295.30698 295.30698 295.30698 ... 295.20697 295.30698 295.40698]\n", " [295.30698 295.107 295.107 ... 294.80698 295.007 295.107 ]]\n", "\n", " [[291.9 290.2 290.5 ... 288.4 288.6 288.9 ]\n", " [291.4 290.7 290.8 ... 289.3 289.5 289.9 ]\n", " [290.7 290.4 290.5 ... 289.9 290.1 290.5 ]\n", " ...\n", " [297.5 297.6 297.5 ... 297.9 297.8 297.7 ]\n", " [297.4 297.4 297.3 ... 297.4 297.5 297.6 ]\n", " [297.2 297.1 297. ... 297. 297.2 297.3 ]]\n", "\n", " [[293.3 291.6 291.9 ... 286.8 286.9 287. ]\n", " [292.8 292.1 292.2 ... 287. 286.9 287. ]\n", " [292.1 291.8 291.9 ... 287.1 287.3 287.5 ]\n", " ...\n", " [299.6 299.7 299.7 ... 300.1 300. 299.8 ]\n", " [299.5 299.5 299.4 ... 299.5 299.7 299.7 ]\n", " [299.4 299.3 299.2 ... 299.2 299.3 299.4 ]]]], 'kelvin')>\n", "Coordinates:\n", " * time1 (time1) datetime64[ns] 2017-09-05T12:00:00 ... 2017-09-06T12:0...\n", " reftime datetime64[ns] 2017-09-05T12:00:00\n", " * latitude (latitude) float32 50.0 49.5 49.0 48.5 ... 11.5 11.0 10.5 10.0\n", " * longitude (longitude) float32 250.0 250.5 251.0 251.5 ... 314.0 314.5 315.0\n", " metpy_crs object Projection: latitude_longitude\n", " * isobaric3 (isobaric3) float64 100.0 200.0 300.0 ... 9.5e+04 9.75e+04 1e+05\n", "Attributes:\n", " long_name: Temperature @ Isobaric surface\n", " Grib_Variable_Id: VAR_0-0-0_L100\n", " Grib2_Parameter: [0 0 0]\n", " Grib2_Parameter_Discipline: Meteorological products\n", " Grib2_Parameter_Category: Temperature\n", " Grib2_Parameter_Name: Temperature\n", " Grib2_Level_Type: 100\n", " Grib2_Level_Desc: Isobaric surface\n", " Grib2_Generating_Process_Type: Forecast\n", " grid_mapping: LatLon_361X720-0p25S-180p00E