Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 4.1 KB

2.a.NAM.md

File metadata and controls

93 lines (70 loc) · 4.1 KB

To provide additional context for the best-track data, model outputs of wind (north–south and east–west components) at 10-m height were collected from the North American Mesoscale Forecast System (NAM), which is produced by National Centers for Environmental Prediction (NCEP) and archived at the National Centers for Environmental Information (NCEI). The NAM Analysis product was used (https://www.ncei.noaa.gov/data/north-american-mesoscale-model/access/analysis/). This product has a spatial resolution of 12 km and temporal resolution of 6 h. This modeling system is commonly used in hurricane research (e.g., Garzon et al. 2018; Liu et al. 2020).

The North American Mesoscale Forecast System (NAM) is one of the National Centers For Environmental Prediction’s (NCEP) major models for producing weather forecasts. NAM generates multiple grids (or domains) of weather forecasts over the North American continent at various horizontal resolutions. Each grid contains data for dozens of weather parameters, including temperature, precipitation, lightning, and turbulent kinetic energy. NAM uses additional numerical weather models to generate high-resolution forecasts over fixed regions, and occasionally to follow significant weather events like hurricanes.

https://www.ncei.noaa.gov/products/weather-climate-models/north-american-mesoscale

AIRS: http://www.ncdc.noaa.gov/has/HAS.FileAppRouter?datasetname=NAMANL218&subqueryby=STATION&applname=&outdest=FILE

THREDDS: https://www.ncei.noaa.gov/thredds/catalog/model-namanl/catalog.html

HTTP: https://www.ncei.noaa.gov/data/north-american-mesoscale-model/access/

Using AIRS: (a) 13 Sep (prior to the storm arrival) and (b)–(d) 14–16 Sep

https://unidata.github.io/python-gallery/examples/xarray_500hPa_map.html

THREDDS database

https://www.ncei.noaa.gov/thredds/catalog/model-namanl/202009/20200913
https://www.ncei.noaa.gov/thredds/catalog/model-namanl/202009/20200914
https://www.ncei.noaa.gov/thredds/catalog/model-namanl/202009/20200915
https://www.ncei.noaa.gov/thredds/catalog/model-namanl/202009/20200916

env.yml

name: nam
channels:
  - conda-forge
dependencies:
 - cartopy
 - netcdf4
 - xarray
 - wget
 - scipy
 - matplotlib
 - notebook
conda env create --prefix ./env_nam -f env.yml
conda activate /Users/lllowe/TOPS/nam/env_nam
jupyter-notebook xarray_500hPa_map.ipynb 

https://github.com/ecmwf/cfgrib

Filter heterogeneous GRIB files xr.open_dataset can open a GRIB file only if all the messages with the same shortName can be represented as a single hypercube. For example, a variable t cannot have both isobaricInhPa and hybrid typeOfLevel's, as this would result in multiple hypercubes for the same variable. Opening a non-conformant GRIB file will fail with a ValueError: multiple values for unique key... error message, see #2.

Furthermore if different variables depend on the same coordinate, for example step, the values of the coordinate must match exactly. For example, if variables t and z share the same step coordinate, they must both have exactly the same set of steps. Opening a non-conformant GRIB file will fail with a ValueError: key present and new value is different... error message, see #13.

In most cases you can handle complex GRIB files containing heterogeneous messages by passing the filter_by_keys key in backend_kwargs to select which GRIB messages belong to a well formed set of hypercubes.

The relevant code in the Notebook:

import cfgrib
# I downloaded the data to my Mac
file = 'namanl_218_2020091506.g2/nam_218_20200915_0600_000.grb2'
#need cfgrib.open for nam, xr.open(cfgrib) gives problems. 
ds = cfgrib.open_datasets(file)
#Find which piece has pres,t,u,v,q
#ds
#It was the sixth one
df = ds[6]
#Rename coordinates to something VisIt recognizes and can translate
#First rename longitude, latitude 
df = df.rename({'longitude':'LONGXY','latitude':'LATIXY'})
#Rename x and y to longitude,latitude
df = df.rename_dims({'x': 'longitude','y': 'latitude'})
#Remap, so we can overlay -lon formatted data (e.g., HURDAT)
with df as src:
    df.coords['LONGXY'] = (df.coords['LONGXY'] + 180) % 360 - 180
#Output to netCDF
df.to_netcdf("data.nc")