{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "
\n", "\n", "
\n", "\"Unidata\n", "
\n", "\n", "# Grid Levels and Parameters\n", "**Python-AWIPS Tutorial Notebook**\n", "\n", "
\n", "
\n", "\n", "---\n", "\n", "\n", "# Objectives\n", "\n", "* Cover the relevant methods for accessing EDEX and investigating what data is available. \n", "* This example we look at the \"grid\" data type and investigate the Global Forcast System (GFS) model. \n", "* We will talk quite a bit about the **DataAccessLayer** utility, and its [online documentation](http://unidata.github.io/python-awips/api/DataAccessLayer.html#) might be a helpful reference.\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": { "toc": true }, "source": [ "

Table of Contents

\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports\n", "\n", "Start by importing the DataAccessLayer package from python-awips:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from awips.dataaccess import DataAccessLayer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Connect to EDEX\n", "\n", "Define a url for your EDEX connection, and then point python-awips at that EDEX" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Unidata's cloud EDEX instance is used in this example\n", "edex_url = \"edex-cloud.unidata.ucar.edu\"\n", "DataAccessLayer.changeEDEXHost(edex_url)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get a List of Supported Data Types\n", "\n", "[***DataAccessLayer.getSupportedDatatypes()***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getSupportedDatatypes) returns a list of supported data types offered by the EDEX server defined above. The code below shows how to populate, sort, and print out that list." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['acars',\n", " 'airep',\n", " 'binlightning',\n", " 'bufrmosavn',\n", " 'bufrmoseta',\n", " 'bufrmosgfs',\n", " 'bufrmoshpc',\n", " 'bufrmoslamp',\n", " 'bufrmosmrf',\n", " 'bufrua',\n", " 'climate',\n", " 'common_obs_spatial',\n", " 'dmw',\n", " 'gfe',\n", " 'gfeeditarea',\n", " 'grid',\n", " 'ldadmesonet',\n", " 'maps',\n", " 'modelsounding',\n", " 'obs',\n", " 'pirep',\n", " 'practicewarning',\n", " 'profiler',\n", " 'radar',\n", " 'radar_spatial',\n", " 'satellite',\n", " 'sfcobs',\n", " 'topo',\n", " 'warning']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataTypes = DataAccessLayer.getSupportedDatatypes()\n", "dataTypes.sort()\n", "list(dataTypes)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a New Data Request and Set the Type\n", "\n", "Now create a new data request using [***DataAccessLayer.newDataRequest()***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.newDataRequest), and set the data type using [***request.setDatatype()***](http://unidata.github.io/python-awips/api/IDataRequest.html#awips.dataaccess.IDataRequest.setDatatype). Below we create a few different requests with different data types to show some differences with other methods.\n", "\n", "For this example we are going to look at the ***grid*** data type, which is where the model data can be found, along with some other datasets (such as MRMS)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Create a request for data type grid\n", "grid_request = DataAccessLayer.newDataRequest()\n", "grid_request.setDatatype(\"grid\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get Available Locations\n", "\n", "Use the [***DataAccessLayer.getAvailableLocationNames(request)***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getAvailableLocationNames) method to find out what locations are available for the given dataset. Typically these will be geographic locations or NWS sites, although in some instances it will be something else. Take a look at what's outputted for the grid_request, for example." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['AK-NAM11',\n", " 'AUTOSPE',\n", " 'BLENDED-PCT_TPW-Sat',\n", " 'BLENDED-Rain_Rate-Sat',\n", " 'BLENDED-TPW-Sat',\n", " 'ESTOFS',\n", " 'ETSS',\n", " 'FFG-ALR',\n", " 'FFG-FWR',\n", " 'FFG-KRF',\n", " 'FFG-MSR',\n", " 'FFG-ORN',\n", " 'FFG-PTR',\n", " 'FFG-RHA',\n", " 'FFG-RSA',\n", " 'FFG-STR',\n", " 'FFG-TAR',\n", " 'FFG-TIR',\n", " 'FFG-TUA',\n", " 'GFS1p0',\n", " 'GFS20',\n", " 'GOES-East_Gridded_Turbulence',\n", " 'GOES-West_Gridded_Turbulence',\n", " 'GlobalWave',\n", " 'GribModel:7:14:108',\n", " 'GribModel:7:4:21',\n", " 'GribModel:7:9:0',\n", " 'HFR-EAST_6KM',\n", " 'HFR-EAST_PR_6KM',\n", " 'HFR-US_EAST_DELAWARE_1KM',\n", " 'HFR-US_EAST_FLORIDA_2KM',\n", " 'HFR-US_EAST_NORTH_2KM',\n", " 'HFR-US_EAST_SOUTH_2KM',\n", " 'HFR-US_EAST_VIRGINIA_1KM',\n", " 'HFR-US_HAWAII_1KM',\n", " 'HFR-US_HAWAII_2KM',\n", " 'HFR-US_HAWAII_6KM',\n", " 'HFR-US_WEST_500M',\n", " 'HFR-US_WEST_CENCAL_2KM',\n", " 'HFR-US_WEST_LOSANGELES_1KM',\n", " 'HFR-US_WEST_LOSOSOS_1KM',\n", " 'HFR-US_WEST_NORTH_2KM',\n", " 'HFR-US_WEST_SANFRAN_1KM',\n", " 'HFR-US_WEST_SOCAL_2KM',\n", " 'HFR-US_WEST_WASHINGTON_1KM',\n", " 'HFR-WEST_6KM',\n", " 'HPCGuide',\n", " 'HPCqpfNDFD',\n", " 'HREF-AK',\n", " 'HREF-HI',\n", " 'HREF-SJU',\n", " 'HREF-US',\n", " 'HRRR',\n", " 'HRRR-Smoke',\n", " 'HiResW-ARW',\n", " 'HiResW-ARW-AK',\n", " 'HiResW-ARW-GU',\n", " 'HiResW-ARW-HI',\n", " 'HiResW-ARW-SJU',\n", " 'HiResW-FV3',\n", " 'HiResW-FV3-AK',\n", " 'HiResW-FV3-GU',\n", " 'HiResW-FV3-HI',\n", " 'HiResW-FV3-SJU',\n", " 'LAMP2p5',\n", " 'LightningCast',\n", " 'MRMS_0500',\n", " 'MRMS_1000',\n", " 'MRMS_AK_1000',\n", " 'MRMS_CA_0500',\n", " 'MRMS_CA_1000',\n", " 'MRMS_GU_0500',\n", " 'MRMS_HI_0500',\n", " 'NAM12',\n", " 'NAM40',\n", " 'NationalBlend',\n", " 'NationalBlendPR',\n", " 'RAP13',\n", " 'RTMA',\n", " 'RTOFS-HudsonBaffin',\n", " 'RTOFS-Now-HudsonBaffin',\n", " 'RTOFS-Now-WestAtl',\n", " 'RTOFS-Now-WestConus',\n", " 'RTOFS-WestAtl',\n", " 'RTOFS-WestConus',\n", " 'SPCGuide',\n", " 'SeaIce',\n", " 'TPCWindProb',\n", " 'URMA25']" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Grid Locations\n", "grid_locations = DataAccessLayer.getAvailableLocationNames(grid_request)\n", "grid_locations.sort()\n", "list(grid_locations)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get Available Parameters\n", "\n", "We're setting the \"location\" (in this case, what model we are interested in) to specify our request before we look at the available parameters.\n", "\n", "Take a look at the available parameters for the data set by using [***DataAccessLayer.getAvailableParameters(request)***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getAvailableParameters)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['-10C Hgt AGL',\n", " '-12 to -18C Omega',\n", " '-12 to -18C Thickness',\n", " '-12C Hgt',\n", " '-18C Hgt',\n", " '-20C Hgt AGL',\n", " '-30C Hgt AGL',\n", " '0 to 3km Line Normal Shear Vectors (Left)',\n", " '0 to 3km Line Normal Shear Vectors (Right)',\n", " '0-10km Blk Shr Mag',\n", " '0-10km Blk Shr Vect',\n", " '0-1km Blk Shr Mag',\n", " '0-1km Blk Shr Vect',\n", " '0-1km EHI',\n", " '0-1km Helicity',\n", " '0-1km Mixing Ratio',\n", " '0-1km Moisture Convergence',\n", " '0-1km Theta-E',\n", " '0-1km Theta-E Adv',\n", " '0-1km Wind Streamlines',\n", " '0-2km Blk Shr Mag',\n", " '0-2km Blk Shr Vect',\n", " '0-2km EHI',\n", " '0-2km Helicity',\n", " '0-3km Blk Shr Mag',\n", " '0-3km Blk Shr Vect',\n", " '0-3km EHI',\n", " '0-3km Helicity',\n", " '0-3km LR',\n", " '0-3km MLCAPE',\n", " '0-3km ThetaE Diff',\n", " '0-3km VGP',\n", " '0-500m Blk Shr Mag',\n", " '0-500m Blk Shr Vect',\n", " '0-500m Helicity',\n", " '0-500m Wind Streamlines',\n", " '0-6km Blk Shr Mag',\n", " '0-6km Blk Shr Vect',\n", " '0-8km Blk Shr Mag',\n", " '0-8km Blk Shr Vect',\n", " '0C Hgt AGL',\n", " '250mb Height',\n", " '250mb Wind',\n", " '36SHRMi',\n", " '50 dBZ Hail Hgt AGL',\n", " '500-300mb RH',\n", " '500mb Height',\n", " '500mb Temp',\n", " '500mb Wind',\n", " '50dbzZ',\n", " '600mb CAPE',\n", " '600mb CIN',\n", " '625mb CAPE',\n", " '625mb CIN',\n", " '650mb CAPE',\n", " '650mb CIN',\n", " '675mb CAPE',\n", " '675mb CIN',\n", " '700-300mb Mean Wind',\n", " '700-500mb LR',\n", " '700-500mb RH',\n", " '700mb CAPE',\n", " '700mb CIN',\n", " '700mb Dew Point',\n", " '700mb Height',\n", " '700mb Temp',\n", " '700mb Wind',\n", " '700mb Wind Streamlines',\n", " '725mb CAPE',\n", " '725mb CIN',\n", " '750mb CAPE',\n", " '750mb CIN',\n", " '775mb CAPE',\n", " '775mb CIN',\n", " '800mb CAPE',\n", " '800mb CIN',\n", " '825mb CAPE',\n", " '825mb CIN',\n", " '850mb CAPE',\n", " '850mb CIN',\n", " '850mb Dew Point',\n", " '850mb Height',\n", " '850mb Moisture Convergence',\n", " '850mb Moisture Flux Divergence',\n", " '850mb Moisture Trans Mag',\n", " '850mb Moisture Transport Vectors',\n", " '850mb Temp',\n", " '850mb Theta-E',\n", " '850mb Theta-E Adv',\n", " '850mb Wind',\n", " '850mb Wind Streamlines',\n", " '875mb CAPE',\n", " '875mb CIN',\n", " '900mb CAPE',\n", " '900mb CIN',\n", " '925mb CAPE',\n", " '925mb CIN',\n", " '925mb Dew Point',\n", " '925mb Height',\n", " '925mb Moisture Convergence',\n", " '925mb Moisture Flux Divergence',\n", " '925mb Moisture Trans Mag',\n", " '925mb Moisture Transport Vectors',\n", " '925mb Temp',\n", " '925mb Theta-E',\n", " '925mb Theta-E Adv',\n", " '925mb Wind',\n", " '925mb Wind Streamlines',\n", " '950mb CAPE',\n", " '950mb CIN',\n", " 'AV',\n", " 'Along',\n", " 'AppT',\n", " 'Avg Cold Nose Wet Bulb Temp',\n", " 'BLI',\n", " 'BRN',\n", " 'BRNEHIi',\n", " 'BRNSHR',\n", " 'BRNmag',\n", " 'BRNvec',\n", " 'BdEPT06',\n", " 'BlkMag',\n", " 'BlkShr',\n", " 'Bulk Richardson Number',\n", " 'Bunkers Elevated Left-Moving Supercell Vectors',\n", " 'Bunkers Elevated Right-Moving Supercell Vectors',\n", " 'Bunkers Left-Moving Supercell Vectors',\n", " 'Bunkers Right-Moving Supercell Vectors',\n", " 'CAPE',\n", " 'CFRZR',\n", " 'CFRZR3hr',\n", " 'CFRZR6hr',\n", " 'CICEP',\n", " 'CICEP3hr',\n", " 'CICEP6hr',\n", " 'CIn',\n", " 'CP',\n", " 'CP-GFS',\n", " 'CP3hr',\n", " 'CP6hr',\n", " 'CPr',\n", " 'CPrD',\n", " 'CRAIN',\n", " 'CRAIN3hr',\n", " 'CRAIN6hr',\n", " 'CSNOW',\n", " 'CSNOW3hr',\n", " 'CSNOW6hr',\n", " 'CURU',\n", " 'CapeStk',\n", " 'Corf',\n", " 'CorfF',\n", " 'CorfFM',\n", " 'CorfM',\n", " 'Corfidi Vectors',\n", " 'CritT1',\n", " 'Critical Angle',\n", " 'Critical Angle (Filtered)',\n", " 'Cross Totals',\n", " 'CumNrm',\n", " 'CumShr',\n", " 'DCAPE',\n", " 'DivF',\n", " 'DivFn',\n", " 'DivFs',\n", " 'DpD',\n", " 'DpT',\n", " 'EHI',\n", " 'EHI01',\n", " 'EHIi',\n", " 'EMSP',\n", " 'EPT',\n", " 'EPTA',\n", " 'EPTC',\n", " 'EPTGrd',\n", " 'EPTGrdM',\n", " 'EPTs',\n", " 'EPVg',\n", " 'EPVs',\n", " 'EPVt1',\n", " 'EPVt2',\n", " 'ESP',\n", " 'ESP2',\n", " 'FVecs',\n", " 'FnVecs',\n", " 'Forward-Propagating Corfidi Vectors',\n", " 'FsVecs',\n", " 'Fzra1',\n", " 'Fzra2',\n", " 'GH',\n", " 'GHxSM',\n", " 'GHxSM2',\n", " 'GVV',\n", " 'HI',\n", " 'HI1',\n", " 'HI1High',\n", " 'HI1Low',\n", " 'HI1Middle',\n", " 'HI3',\n", " 'HI3High',\n", " 'HI3Low',\n", " 'HI3Middle',\n", " 'HI4',\n", " 'HI4High',\n", " 'HI4Low',\n", " 'HI4Middle',\n", " 'HIHigh',\n", " 'HILow',\n", " 'HIMiddle',\n", " 'HIdx',\n", " 'Hail Growth Zone Thickness',\n", " 'Heli',\n", " 'HeliC',\n", " 'INV',\n", " 'IPLayer',\n", " 'Into',\n", " 'K Index',\n", " 'KI',\n", " 'L-I',\n", " 'LIsfc2x',\n", " 'LM5',\n", " 'LM6',\n", " 'Large Hail Parameter',\n", " 'MAdv',\n", " 'MCS Maint Prob',\n", " 'MCon',\n", " 'MCon2',\n", " 'ML Hail Growth CAPE',\n", " 'ML LCL Hgt',\n", " 'MLCAPE',\n", " 'MLCIN',\n", " 'MLLCL',\n", " 'MMP',\n", " 'MSFDi',\n", " 'MSFi',\n", " 'MSFmi',\n", " 'MSG',\n", " 'MSL Pressure',\n", " 'MTV',\n", " 'MUCAPE',\n", " 'Max 0-5km Dew Point Dep',\n", " 'Max Warm Nose Wet Bulb Temp',\n", " 'Mean RH in Dendritic Layer',\n", " 'Microburst Composite',\n", " 'Min Cold Nose Wet Bulb Temp',\n", " 'Mix1',\n", " 'Mix2',\n", " 'Mmag',\n", " 'MnT3hr',\n", " 'MnT6hr',\n", " 'MpV',\n", " 'MxT3hr',\n", " 'MxT6hr',\n", " 'NBE',\n", " 'NSEA_BlkShr500mDir',\n", " 'NSEA_CritAngRMa',\n", " 'NSEA_CritAng_sbCAPECheck',\n", " 'NSEA_CritAng_sbCINCheck',\n", " 'NSEA_DpDMax',\n", " 'NSEA_DpDstk',\n", " 'NSEA_LHP10',\n", " 'NSEA_LHP11',\n", " 'NSEA_LHP12',\n", " 'NSEA_LHP13',\n", " 'NSEA_LHP14',\n", " 'NSEA_LHP15',\n", " 'NSEA_LHP16',\n", " 'NSEA_LHP17',\n", " 'NSEA_LHP18',\n", " 'NSEA_LHP19',\n", " 'NSEA_LHP2',\n", " 'NSEA_LHP20',\n", " 'NSEA_LHP21',\n", " 'NSEA_LHP22',\n", " 'NSEA_LHP23',\n", " 'NSEA_LHP24',\n", " 'NSEA_LHP25',\n", " 'NSEA_LHP26',\n", " 'NSEA_LHP27',\n", " 'NSEA_LHP3',\n", " 'NSEA_LHP4',\n", " 'NSEA_LHP5',\n", " 'NSEA_LHP6',\n", " 'NSEA_LHP7',\n", " 'NSEA_LHP8',\n", " 'NSEA_LHP9',\n", " 'NSEA_SRMrDir',\n", " 'NSEA_TwMax',\n", " 'NSEA_TwMin',\n", " 'NSEA_cCape',\n", " 'NSEA_cCape_0.5kmAGL',\n", " 'NSEA_cCape_1kmAGL',\n", " 'NSEA_cCape_SFC',\n", " 'NSEA_capeToLvl',\n", " 'NSEA_capeToLvl_0.5kmAGL',\n", " 'NSEA_capeToLvl_1kmAGL',\n", " 'NSEA_capeToLvl_SFC',\n", " 'NSEA_maxEPT01',\n", " 'NSEA_minEPT13',\n", " 'NSEA_uBlkShr500m',\n", " 'NSEA_uSRMr',\n", " 'NSEA_vBlkShr500m',\n", " 'NSEA_vSRMr',\n", " 'NST',\n", " 'NST1',\n", " 'NST2',\n", " 'Non-Supercell Tor Parm',\n", " 'OmDiff',\n", " 'P',\n", " 'P3hr',\n", " 'P6hr',\n", " 'PAdv',\n", " 'PBE',\n", " 'PEC',\n", " 'PFrnt',\n", " 'PGrd',\n", " 'PGrd1',\n", " 'PGrdM',\n", " 'PIVA',\n", " 'PTvA',\n", " 'PTyp',\n", " 'PVV',\n", " 'PW',\n", " 'PW2',\n", " 'PoT',\n", " 'PoTA',\n", " 'Precipitable H2O',\n", " 'QPV1',\n", " 'QPV2',\n", " 'QPV3',\n", " 'QPV4',\n", " 'RH',\n", " 'RH_001_bin',\n", " 'RH_002_bin',\n", " 'RM5',\n", " 'RM6',\n", " 'RMprop',\n", " 'RMprop2',\n", " 'RV',\n", " 'Rain1',\n", " 'Rain2',\n", " 'Rain3',\n", " 'Ro',\n", " 'SB Hail Growth CAPE',\n", " 'SB LI',\n", " 'SBCAPE',\n", " 'SBCIN',\n", " 'SH',\n", " 'SHERB_S3',\n", " 'SHx',\n", " 'SLI',\n", " 'SNSQ',\n", " 'SNW',\n", " 'SNWA',\n", " 'SRMl',\n", " 'SRMlM',\n", " 'SRMm',\n", " 'SRMmM',\n", " 'SRMr',\n", " 'SRMrM',\n", " 'SSP',\n", " 'SSi',\n", " 'STP',\n", " 'STP1',\n", " 'SWEAT Index',\n", " 'Sfc Dew Point',\n", " 'Sfc Mixing Ratio',\n", " 'Sfc Moisture Convergence',\n", " 'Sfc Pot Temp',\n", " 'Sfc Temp',\n", " 'Sfc Theta-E',\n", " 'Sfc Theta-E Adv',\n", " 'Sfc Wind',\n", " 'Sfc Wind Streamlines',\n", " 'Sfc-Based LCL Hgt',\n", " 'Shear',\n", " 'Showalter Index',\n", " 'ShrMag',\n", " 'Sig Severe',\n", " 'Sig Tor Parm',\n", " 'Snow1',\n", " 'Snow2',\n", " 'Snow3',\n", " 'SnowT',\n", " 'St-Pr',\n", " 'StrTP',\n", " 'StrmMot',\n", " 'SuCP',\n", " 'Supercell Composite Parm',\n", " 'T',\n", " 'TAdv',\n", " 'TGrd',\n", " 'TGrdM',\n", " 'TORi',\n", " 'TORi2',\n", " 'TP',\n", " 'TP-GFS',\n", " 'TP3hr',\n", " 'TP6hr',\n", " 'TQIND',\n", " 'TShrMi',\n", " 'TV',\n", " 'TW',\n", " 'T_001_bin',\n", " 'Tdef',\n", " 'Tdend',\n", " 'ThGrd',\n", " 'ThetaE',\n", " 'Thom5',\n", " 'Thom5a',\n", " 'Thom6',\n", " 'TmDpD',\n", " 'Tmax',\n", " 'Tmin',\n", " 'TotQi',\n", " 'Total Totals',\n", " 'Tstk',\n", " 'TwMax',\n", " 'TwMin',\n", " 'Twstk',\n", " 'TxSM',\n", " 'VAdv',\n", " 'VAdvAdvection',\n", " 'VGP',\n", " 'VSS',\n", " 'Vertical Totals',\n", " 'WCD',\n", " 'WD',\n", " 'WEASD',\n", " 'Warm Cloud Depth',\n", " 'Warm Cloud Depth Raw',\n", " 'Wind',\n", " 'WndChl',\n", " 'ageoVC',\n", " 'ageoW',\n", " 'ageoWM',\n", " 'cCape',\n", " 'cCin',\n", " 'cTOT',\n", " 'capeToLvl',\n", " 'dCape',\n", " 'dP',\n", " 'dT',\n", " 'dVAdv',\n", " 'dZ',\n", " 'defV',\n", " 'del2gH',\n", " 'df',\n", " 'fGen',\n", " 'fnD',\n", " 'fsD',\n", " 'gamma',\n", " 'gammaE',\n", " 'geoVort',\n", " 'geoW',\n", " 'geoWM',\n", " 'loCape',\n", " 'maxEPT',\n", " 'minEPT',\n", " 'mixRat',\n", " 'msl-P',\n", " 'muCape',\n", " 'pV',\n", " 'pVeq',\n", " 'qDiv',\n", " 'qVec',\n", " 'qnVec',\n", " 'qsVec',\n", " 'shWlt',\n", " 'snoRat',\n", " 'snoRatCrocus',\n", " 'snoRatEMCSREF',\n", " 'snoRatOv2',\n", " 'snoRatSPC',\n", " 'snoRatSPCdeep',\n", " 'snoRatSPCsurface',\n", " 'swtIdx',\n", " 'tTOT',\n", " 'tWind',\n", " 'tWindU',\n", " 'tWindV',\n", " 'uFX',\n", " 'uW',\n", " 'uWStk',\n", " 'ulSnoRat',\n", " 'vSmthW',\n", " 'vTOT',\n", " 'vW',\n", " 'vWStk',\n", " 'vertCirc',\n", " 'wDiv',\n", " 'wSp',\n", " 'wSp_001_bin',\n", " 'wSp_002_bin',\n", " 'wSp_003_bin',\n", " 'wSp_004_bin',\n", " 'zAGL']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Pick a model and set the location for the grid request -- we'll be using the Global Forecast System 20km (GFS20) \n", "grid_request.setLocationNames(\"GFS20\")\n", "grid_params = DataAccessLayer.getAvailableParameters(grid_request)\n", "grid_params.sort()\n", "list(grid_params)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get Available Levels\n", "\n", "\n", "Setting the parameters is just an option, you do not need to filter the data if you do not wish to. Also, although we are only setting one parameter in this example, you can set multiple parameters by using an array:\n", "```\n", "params = (\"param1\", \"param2\", \"param3\"...)\n", "request.setParameters(params)\n", "```\n", "\n", "Set a parameter, from the output above and take a look at what \"levels\" are available for the data set you're looking at using [***DataAccessLayer.getAvailableLevels(request)***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getAvailableLevels)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Warning: Not all datasets support levels. If you are trying this with another dataset and run into an exception (error), it's most likely because levels are not supported for that data type.\n", "
" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.0SFC\n", "0.0_6000.0FHAG\n", "700.0MB\n", "925.0MB\n", "850.0MB\n", "1000.0FHAG\n", "1000.0MB\n", "500.0MB\n", "350.0MB\n", "610.0_40000.0FHAG\n", "120.0_150.0BL\n", "900.0MB\n", "0.0_610.0FHAG\n", "450.0MB\n", "575.0MB\n", "100.0MB\n", "60.0_90.0BL\n", "1.0PV\n", "950.0MB\n", "150.0MB\n", "1.5PV\n", "825.0MB\n", "150.0_180.0BL\n", "250.0MB\n", "1000.0_500.0MB\n", "800.0MB\n", "4000.0FHAG\n", "2.0PV\n", "0.5PV\n", "0.0TROP\n", "750.0MB\n", "625.0MB\n", "400.0MB\n", "0.0FHAG\n", "2.0FHAG\n", "875.0MB\n", "0.0_1000.0FHAG\n", "600.0MB\n", "725.0MB\n", "975.0MB\n", "550.0MB\n", "0.0_3000.0FHAG\n", "675.0MB\n", "200.0MB\n", "0.0_30.0BL\n", "30.0_60.0BL\n", "650.0MB\n", "525.0MB\n", "300.0MB\n", "90.0_120.0BL\n", "775.0MB\n", "2000.0_5000.0FHAG\n", "0.0TILT\n", "0.5TILT\n", "1.8TILT\n", "1.5TILT\n", "2.4TILT\n", "0.9TILT\n", "3.4TILT\n", "340.0_350.0K\n", "290.0_300.0K\n", "700.0_600.0MB\n", "700.0_300.0MB\n", "320.0Ke\n", "800.0_750.0MB\n", "60.0TILT\n", "5.3TILT\n", "1000.0_900.0MB\n", "340.0K\n", "5500.0_6000.0FHAG\n", "255.0K\n", "255.0_265.0K\n", "3000.0_6000.0FHAG\n", "25.0TILT\n", "2000.0FHAG\n", "0.0_500.0FHAG\n", "1000.0_850.0MB\n", "850.0_250.0MB\n", "280.0_290.0Ke\n", "1524.0FHAG\n", "320.0_330.0K\n", "310.0_320.0Ke\n", "310.0Ke\n", "330.0K\n", "900.0_800.0MB\n", "550.0_500.0MB\n", "50.0TILT\n", "3500.0FHAG\n", "35.0TILT\n", "12.0TILT\n", "300.0_310.0K\n", "3000.0_12000.0FHAG\n", "320.0K\n", "400.0_350.0MB\n", "500.0FHAG\n", "750.0_700.0MB\n", "1000.0_400.0MB\n", "345.0K\n", "250.0_260.0K\n", "300.0Ke\n", "290.0Ke\n", "950.0_900.0MB\n", "4572.0FHAG\n", "275.0_285.0Ke\n", "335.0Ke\n", "295.0_305.0Ke\n", "275.0_285.0K\n", "600.0_550.0MB\n", "310.0K\n", "9000.0FHAG\n", "335.0K\n", "1000.0_7000.0FHAG\n", "700.0_500.0MB\n", "9144.0FHAG\n", "325.0_335.0K\n", "2000.0_8000.0FHAG\n", "0.0_609.6FHAG\n", "300.0K\n", "0.0MAXOMEGA\n", "315.0_325.0K\n", "325.0K\n", "340.0Ke\n", "0.0_4000.0FHAG\n", "5000.0_5500.0FHAG\n", "300.0_250.0MB\n", "335.0_345.0K\n", "0.0_300000.0FHAG\n", "315.0K\n", "2500.0FHAG\n", "10000.0FHAG\n", "0.0_2000.0FHAG\n", "7000.0FHAG\n", "5000.0FHAG\n", "330.0Ke\n", "500.0_400.0MB\n", "1000.0_1500.0FHAG\n", "305.0K\n", "285.0_295.0Ke\n", "14.0TILT\n", "3000.0_3500.0FHAG\n", "325.0_335.0Ke\n", "7620.0FHAG\n", "850.0_800.0MB\n", "6096.0FHAG\n", "6000.0_7000.0FHAG\n", "2000.0_7000.0FHAG\n", "9000.0_10000.0FHAG\n", "295.0Ke\n", "305.0Ke\n", "265.0_275.0K\n", "7000.0_8000.0FHAG\n", "3000.0_8000.0FHAG\n", "700.0_650.0MB\n", "1000.0_6000.0FHAG\n", "450.0_400.0MB\n", "330.0_340.0K\n", "800.0_700.0MB\n", "850.0_300.0MB\n", "6.0TILT\n", "900.0_850.0MB\n", "3657.6FHAG\n", "0.0_5000.0FHAG\n", "320.0_330.0Ke\n", "8.7TILT\n", "650.0_600.0MB\n", "600.0_400.0MB\n", "55.0TILT\n", "270.0_280.0Ke\n", "30.0TILT\n", "310.0_320.0K\n", "1500.0FHAG\n", "1000.0_950.0MB\n", "5500.0FHAG\n", "250.0_200.0MB\n", "500.0_1000.0FHAG\n", "1100.0_800.0MB\n", "400.0_300.0MB\n", "800.0_500.0MB\n", "500.0_300.0MB\n", "500.0_100.0MB\n", "1000.0_3000.0FHAG\n", "8000.0FHAG\n", "285.0Ke\n", "290.0K\n", "305.0_315.0K\n", "285.0_295.0K\n", "0.0_2500.0FHAG\n", "925.0_850.0MB\n", "275.0Ke\n", "1500.0_2000.0FHAG\n", "300.0_200.0MB\n", "260.0_270.0K\n", "2743.2FHAG\n", "3000.0FHAG\n", "315.0_325.0Ke\n", "600.0_500.0MB\n", "16.7TILT\n", "280.0K\n", "500.0_250.0MB\n", "40.0TILT\n", "3048.0FHAG\n", "400.0_200.0MB\n", "300.0_310.0Ke\n", "270.0_280.0K\n", "1000.0_700.0MB\n", "45.0TILT\n", "850.0_500.0MB\n", "2500.0_3000.0FHAG\n", "609.6FHAG\n", "0.0_8000.0FHAG\n", "295.0K\n", "4.3TILT\n", "295.0_305.0K\n", "330.0_340.0Ke\n", "270.0K\n", "4000.0_4500.0FHAG\n", "280.0_290.0K\n", "925.0_700.0MB\n", "0.0_1500.0FHAG\n", "260.0K\n", "10.0TILT\n", "3500.0_4000.0FHAG\n", "325.0Ke\n", "285.0K\n", "290.0_300.0Ke\n", "7.5TILT\n", "1828.8FHAG\n", "280.0Ke\n", "500.0_450.0MB\n", "914.4FHAG\n", "305.0_315.0Ke\n", "250.0K\n", "4500.0FHAG\n", "1250.0FHAG\n", "0.0_10000.0FHAG\n", "4500.0_5000.0FHAG\n", "250.0_350.0K\n", "270.0Ke\n", "275.0K\n", "315.0Ke\n", "350.0_300.0MB\n", "750.0FHAG\n", "19.5TILT\n", "2000.0_2500.0FHAG\n", "850.0_700.0MB\n", "350.0K\n", "265.0K\n", "6000.0FHAG\n", "8000.0_9000.0FHAG\n" ] } ], "source": [ "# For grid data we'll use the temperature parameter (\"T\")\n", "grid_request.setParameters(\"T\")\n", "grid_levels = DataAccessLayer.getAvailableLevels(grid_request)\n", "for lvl in grid_levels:\n", " print(lvl)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Note: \n", "
  • 0.0SFC is the Surface level
  • \n", "
  • HAG stands for Fixed Height Above Ground (in meters)
  • \n", "
  • NTAT stands for Nominal Top of the ATmosphere
  • \n", "
  • BL stands for Boundary Layer, where 0.0_30.0BL reads as 0-30 mb above ground level
  • \n", "
  • TROP is the Tropopause level\n", "
  • " ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# We'll set the level to surface level\n", "grid_request.setLevels(\"0.0SFC\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get Available Times\n", "\n", "Take a look at what time options are available for the data you're looking at using the [***DataAccessLayer.getAvailableTimes()***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getAvailableTimes) method:\n", "\n", "* **getAvailableTimes(request, True)** will return an object of *run times* - formatted as `YYYY-MM-DD HH:MM:SS`\n", "* **getAvailableTimes(request)** will return an object of all times - formatted as `YYYY-MM-DD HH:MM:SS (F:ff)`\n", "* **getForecastRun(cycle, times)** will return a DataTime array for a single forecast cycle." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2025-02-12 18:00:00.000 : 0 seconds\n", "2025-02-12 18:00:00.000 : 10800 seconds\n", "2025-02-12 18:00:00.000 : 21600 seconds\n", "2025-02-12 18:00:00.000 : 32400 seconds\n", "2025-02-12 18:00:00.000 : 43200 seconds\n", "2025-02-12 18:00:00.000 : 54000 seconds\n", "2025-02-12 18:00:00.000 : 64800 seconds\n", "2025-02-12 18:00:00.000 : 75600 seconds\n", "2025-02-12 18:00:00.000 : 86400 seconds\n", "2025-02-12 18:00:00.000 : 97200 seconds\n", "2025-02-12 18:00:00.000 : 108000 seconds\n", "2025-02-12 18:00:00.000 : 118800 seconds\n", "2025-02-12 18:00:00.000 : 129600 seconds\n", "2025-02-12 18:00:00.000 : 140400 seconds\n", "2025-02-12 18:00:00.000 : 151200 seconds\n", "2025-02-12 18:00:00.000 : 162000 seconds\n", "2025-02-12 18:00:00.000 : 172800 seconds\n", "2025-02-12 18:00:00.000 : 183600 seconds\n", "2025-02-12 18:00:00.000 : 194400 seconds\n", "2025-02-12 18:00:00.000 : 205200 seconds\n", "2025-02-12 18:00:00.000 : 216000 seconds\n", "2025-02-12 18:00:00.000 : 226800 seconds\n", "2025-02-12 18:00:00.000 : 237600 seconds\n", "2025-02-12 18:00:00.000 : 248400 seconds\n", "2025-02-12 18:00:00.000 : 259200 seconds\n", "2025-02-12 18:00:00.000 : 270000 seconds\n", "2025-02-12 18:00:00.000 : 280800 seconds\n", "2025-02-12 18:00:00.000 : 291600 seconds\n", "2025-02-12 18:00:00.000 : 302400 seconds\n", "2025-02-12 18:00:00.000 : 324000 seconds\n", "2025-02-12 18:00:00.000 : 345600 seconds\n", "2025-02-12 18:00:00.000 : 367200 seconds\n", "2025-02-12 18:00:00.000 : 388800 seconds\n", "2025-02-12 18:00:00.000 : 410400 seconds\n", "2025-02-12 18:00:00.000 : 432000 seconds\n", "2025-02-12 18:00:00.000 : 453600 seconds\n", "2025-02-12 18:00:00.000 : 475200 seconds\n", "2025-02-12 18:00:00.000 : 496800 seconds\n", "2025-02-12 18:00:00.000 : 540000 seconds\n", "2025-02-12 18:00:00.000 : 583200 seconds\n", "2025-02-12 18:00:00.000 : 604800 seconds\n", "2025-02-12 18:00:00.000 : 626400 seconds\n", "2025-02-12 18:00:00.000 : 648000 seconds\n", "2025-02-12 18:00:00.000 : 669600 seconds\n", "2025-02-12 18:00:00.000 : 691200 seconds\n", "2025-02-12 18:00:00.000 : 712800 seconds\n", "2025-02-12 18:00:00.000 : 734400 seconds\n", "2025-02-12 18:00:00.000 : 756000 seconds\n", "2025-02-12 18:00:00.000 : 777600 seconds\n" ] } ], "source": [ "# Available grid times\n", "grid_cycles = DataAccessLayer.getAvailableTimes(grid_request, True)\n", "grid_times = DataAccessLayer.getAvailableTimes(grid_request)\n", "## Using -1 in an array will access the last element of the array \n", "## (using -2 will access the second last element, and so on)\n", "grid_fcstRun = DataAccessLayer.getForecastRun(grid_cycles[-1], grid_times)\n", "\n", "## print out the time instances\n", "times = []\n", "for fcst in grid_fcstRun:\n", " print(fcst.getRefTime(), ':', fcst.getFcstTime(), 'seconds')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get the Data!\n", "\n", "Now that we have our `request` and DataTime `fcstRun` arrays ready, it's time to request the data array from EDEX. Depending on what kind of data we're working with, we'll either use [***DataAccessLayer.getGridData()***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getGridData) or [***DataAccessLayer.getGeometryData()***](http://unidata.github.io/python-awips/api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getGeometryData)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
    \n", "Note: We have more, detailed notebooks about how analyze and visualize the data once you have what you want.\n", "
    " ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Time : 2025-02-12 18:00:00 (216) - 777600 seconds\n", "Model: GFS20\n", "Parm : T\n", "Unit : K\n", "(257, 369)\n" ] } ], "source": [ "## Grid Data\n", "grid_response = DataAccessLayer.getGridData(grid_request, [grid_fcstRun[-1]])\n", "for grid in grid_response:\n", " grid_data = grid.getRawData()\n", " lons, lats = grid.getLatLonCoords()\n", " print('Time :', grid.getDataTime(), \"-\", grid.getDataTime().getFcstTime(), 'seconds')\n", "\n", "## Take a look at some information in our data\n", "print('Model:', str(grid.getLocationName()))\n", "print('Parm :', str(grid.getParameter()))\n", "print('Unit :', str(grid.getUnit()))\n", "print(grid_data.shape)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## See Also\n", "\n", "Several functions are used throughout this notebook from the DataAccessLayer class in python-awips, to see full documentation for these functions vist [**here**](http://unidata.github.io/python-awips/api/DataAccessLayer.html#).\n", "\n", "### Related Notebooks\n", "\n", "* [Colored Surface Temperature Plot](https://unidata.github.io/python-awips/examples/generated/Colored_Surface_Temperature_Plot.html)\n", "* [Grids and Cartopy](https://unidata.github.io/python-awips/examples/generated/Grids_and_Cartopy.html)\n", "* [Satellite Imagery](https://unidata.github.io/python-awips/examples/generated/Satellite_Imagery.html)\n", "* [Upper Air BUFR Soundings](https://unidata.github.io/python-awips/examples/generated/Upper_Air_BUFR_Soundings.html)\n", "* [Maps Resources and Topography](https://unidata.github.io/python-awips/examples/generated/Map_Resources_and_Topography.html)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Top\n", "\n", "---" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.1" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": {}, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 4 }