Last active
October 12, 2017 20:27
-
-
Save cbarrick/b98865176450b28fb0c52f5f8c737495 to your computer and use it in GitHub Desktop.
ncdump and usage code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ncdump -h NAM-NMM/nam.20161111/nam.t00z.awphys.tm00.nc | |
netcdf nam.t00z.awphys.tm00 { | |
dimensions: | |
reftime = 1 ; | |
z_HTGL3 = 2 ; | |
z_ISBL3 = 5 ; | |
z_ISBL2 = 42 ; | |
z_HTGL2 = 2 ; | |
z_HTGL1 = 2 ; | |
z_ISBL1 = 39 ; | |
y = 160 ; | |
x = 160 ; | |
forecast = 37 ; | |
z_SFC = 1 ; | |
z_MWSL = 1 ; | |
z_TRO = 1 ; | |
z_HTGL = 1 ; | |
z_CBL = 1 ; | |
z_0DEG = 1 ; | |
z_PBL = 1 ; | |
z_LLTW = 1 ; | |
z_SPDY = 6 ; | |
z_SIGY = 1 ; | |
z_EATM = 1 ; | |
z_HYBL = 1 ; | |
variables: | |
int64 reftime(reftime) ; | |
reftime:units = "days since 2016-11-11 00:00:00" ; | |
reftime:calendar = "proleptic_gregorian" ; | |
int z_HTGL3(z_HTGL3) ; | |
z_HTGL3:long_name = "fixed height above ground" ; | |
z_HTGL3:units = "m" ; | |
int z_ISBL3(z_ISBL3) ; | |
z_ISBL3:long_name = "isobaric level" ; | |
z_ISBL3:units = "Pa" ; | |
int z_ISBL2(z_ISBL2) ; | |
z_ISBL2:long_name = "isobaric level" ; | |
z_ISBL2:units = "Pa" ; | |
int z_HTGL2(z_HTGL2) ; | |
z_HTGL2:long_name = "fixed height above ground" ; | |
z_HTGL2:units = "m" ; | |
int z_HTGL1(z_HTGL1) ; | |
z_HTGL1:long_name = "fixed height above ground" ; | |
z_HTGL1:units = "m" ; | |
int z_ISBL1(z_ISBL1) ; | |
z_ISBL1:long_name = "isobaric level" ; | |
z_ISBL1:units = "Pa" ; | |
float rot(y, x) ; | |
rot:_FillValue = NaNf ; | |
rot:grid_description = "AWIPS grid over the Contiguous United States (used by the 12-km ETA Model) (Lambert Conformal)" ; | |
rot:long_name = "vector rotation angle" ; | |
rot:units = "radians" ; | |
rot:formula_u = "Uearth = sin(rot)*Vgrid + cos(rot)*Ugrid" ; | |
rot:formula_v = "Vearth = cos(rot)*Vgrid - sin(rot)*Ugrid" ; | |
rot:note1 = "u and v components of vector quantities are resolved relative to grid" ; | |
rot:note2 = "apply formulas to derive u and v components relative to earth" ; | |
float lat(y, x) ; | |
lat:_FillValue = NaNf ; | |
lat:corners = 12.19f, 14.35541f, 57.34082f, 54.56082f ; | |
lat:long_name = "latitude" ; | |
lat:grid_description = "AWIPS grid over the Contiguous United States (used by the 12-km ETA Model) (Lambert Conformal)" ; | |
lat:units = "degrees_north" ; | |
lat:mpLambertMeridianF = 265.f ; | |
lat:mpLambertParallel2F = 25.f ; | |
lat:mpLambertParallel1F = 25.f ; | |
lat:mpProjection = "LAMBERTCONFORMAL" ; | |
lat:Latin2 = 25.f ; | |
lat:Latin1 = 25.f ; | |
lat:Dy = 12190.58f ; | |
lat:Dx = 12190.58f ; | |
lat:Lov = 265.f ; | |
lat:Lo1 = 226.514f ; | |
lat:La1 = 12.19f ; | |
float lon(y, x) ; | |
lon:_FillValue = NaNf ; | |
lon:corners = -133.486f, -65.15181f, -49.45374f, -152.9172f ; | |
lon:long_name = "longitude" ; | |
lon:grid_description = "AWIPS grid over the Contiguous United States (used by the 12-km ETA Model) (Lambert Conformal)" ; | |
lon:units = "degrees_east" ; | |
lon:mpLambertMeridianF = 265.f ; | |
lon:mpLambertParallel2F = 25.f ; | |
lon:mpLambertParallel1F = 25.f ; | |
lon:mpProjection = "LAMBERTCONFORMAL" ; | |
lon:Latin2 = 25.f ; | |
lon:Latin1 = 25.f ; | |
lon:Dy = 12190.58f ; | |
lon:Dx = 12190.58f ; | |
lon:Lov = 265.f ; | |
lon:Lo1 = 226.514f ; | |
lon:La1 = 12.19f ; | |
double x(x) ; | |
x:_FillValue = NaN ; | |
double y(y) ; | |
y:_FillValue = NaN ; | |
int64 forecast(forecast) ; | |
forecast:units = "hours since 2016-11-11 00:00:00+00:00" ; | |
float PRES_SFC(reftime, forecast, z_SFC, y, x) ; | |
PRES_SFC:_FillValue = 1.e+20f ; | |
PRES_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
PRES_SFC:long_name = "Pressure" ; | |
PRES_SFC:units = "Pa" ; | |
PRES_SFC:level_indicator = 1 ; | |
PRES_SFC:grid_number = 218 ; | |
PRES_SFC:parameter_table_version = 2 ; | |
PRES_SFC:parameter_number = 1 ; | |
PRES_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
PRES_SFC:forecast_time_units = "hours" ; | |
PRES_SFC:initial_time = "11/11/2016 (00:00)" ; | |
PRES_SFC:coordinates = "rot lon lat" ; | |
float PRES_MWSL(reftime, forecast, z_MWSL, y, x) ; | |
PRES_MWSL:_FillValue = 1.e+20f ; | |
PRES_MWSL:center = "US National Weather Service - NCEP (WMC)" ; | |
PRES_MWSL:long_name = "Pressure" ; | |
PRES_MWSL:units = "Pa" ; | |
PRES_MWSL:level_indicator = 6 ; | |
PRES_MWSL:grid_number = 218 ; | |
PRES_MWSL:parameter_table_version = 2 ; | |
PRES_MWSL:parameter_number = 1 ; | |
PRES_MWSL:model = "MESO NAM Model (currently 12 km)" ; | |
PRES_MWSL:forecast_time_units = "hours" ; | |
PRES_MWSL:initial_time = "11/11/2016 (00:00)" ; | |
PRES_MWSL:coordinates = "rot lon lat" ; | |
float PRES_TRO(reftime, forecast, z_TRO, y, x) ; | |
PRES_TRO:_FillValue = 1.e+20f ; | |
PRES_TRO:center = "US National Weather Service - NCEP (WMC)" ; | |
PRES_TRO:long_name = "Pressure" ; | |
PRES_TRO:units = "Pa" ; | |
PRES_TRO:level_indicator = 7 ; | |
PRES_TRO:grid_number = 218 ; | |
PRES_TRO:parameter_table_version = 2 ; | |
PRES_TRO:parameter_number = 1 ; | |
PRES_TRO:model = "MESO NAM Model (currently 12 km)" ; | |
PRES_TRO:forecast_time_units = "hours" ; | |
PRES_TRO:initial_time = "11/11/2016 (00:00)" ; | |
PRES_TRO:coordinates = "rot lon lat" ; | |
float PRES_HTGL(reftime, forecast, z_HTGL, y, x) ; | |
PRES_HTGL:_FillValue = 1.e+20f ; | |
PRES_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
PRES_HTGL:long_name = "Pressure" ; | |
PRES_HTGL:units = "Pa" ; | |
PRES_HTGL:level_indicator = 105 ; | |
PRES_HTGL:grid_number = 218 ; | |
PRES_HTGL:parameter_table_version = 2 ; | |
PRES_HTGL:parameter_number = 1 ; | |
PRES_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
PRES_HTGL:level = 80 ; | |
PRES_HTGL:forecast_time_units = "hours" ; | |
PRES_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
PRES_HTGL:coordinates = "rot lon lat" ; | |
float HGT_SFC(reftime, forecast, z_SFC, y, x) ; | |
HGT_SFC:_FillValue = 1.e+20f ; | |
HGT_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_SFC:long_name = "Geopotential height" ; | |
HGT_SFC:units = "gpm" ; | |
HGT_SFC:level_indicator = 1 ; | |
HGT_SFC:grid_number = 218 ; | |
HGT_SFC:parameter_table_version = 2 ; | |
HGT_SFC:parameter_number = 7 ; | |
HGT_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_SFC:forecast_time_units = "hours" ; | |
HGT_SFC:initial_time = "11/11/2016 (00:00)" ; | |
HGT_SFC:coordinates = "rot lon lat" ; | |
float HGT_CBL(reftime, forecast, z_CBL, y, x) ; | |
HGT_CBL:_FillValue = 1.e+20f ; | |
HGT_CBL:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_CBL:long_name = "Geopotential height" ; | |
HGT_CBL:units = "gpm" ; | |
HGT_CBL:level_indicator = 2 ; | |
HGT_CBL:grid_number = 218 ; | |
HGT_CBL:parameter_table_version = 2 ; | |
HGT_CBL:parameter_number = 7 ; | |
HGT_CBL:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_CBL:forecast_time_units = "hours" ; | |
HGT_CBL:initial_time = "11/11/2016 (00:00)" ; | |
HGT_CBL:coordinates = "rot lon lat" ; | |
float HGT_0DEG(reftime, forecast, z_0DEG, y, x) ; | |
HGT_0DEG:_FillValue = 1.e+20f ; | |
HGT_0DEG:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_0DEG:long_name = "Geopotential height" ; | |
HGT_0DEG:units = "gpm" ; | |
HGT_0DEG:level_indicator = 4 ; | |
HGT_0DEG:grid_number = 218 ; | |
HGT_0DEG:parameter_table_version = 2 ; | |
HGT_0DEG:parameter_number = 7 ; | |
HGT_0DEG:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_0DEG:forecast_time_units = "hours" ; | |
HGT_0DEG:initial_time = "11/11/2016 (00:00)" ; | |
HGT_0DEG:coordinates = "rot lon lat" ; | |
float HGT_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
HGT_ISBL:_FillValue = 1.e+20f ; | |
HGT_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_ISBL:long_name = "Geopotential height" ; | |
HGT_ISBL:units = "gpm" ; | |
HGT_ISBL:level_indicator = 100 ; | |
HGT_ISBL:grid_number = 218 ; | |
HGT_ISBL:parameter_table_version = 2 ; | |
HGT_ISBL:parameter_number = 7 ; | |
HGT_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_ISBL:forecast_time_units = "hours" ; | |
HGT_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
HGT_ISBL:coordinates = "rot lon lat" ; | |
float HGT_PBL(reftime, forecast, z_PBL, y, x) ; | |
HGT_PBL:_FillValue = 1.e+20f ; | |
HGT_PBL:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_PBL:long_name = "Geopotential height" ; | |
HGT_PBL:units = "gpm" ; | |
HGT_PBL:level_indicator = 220 ; | |
HGT_PBL:grid_number = 218 ; | |
HGT_PBL:parameter_table_version = 2 ; | |
HGT_PBL:parameter_number = 7 ; | |
HGT_PBL:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_PBL:forecast_time_units = "hours" ; | |
HGT_PBL:initial_time = "11/11/2016 (00:00)" ; | |
HGT_PBL:coordinates = "rot lon lat" ; | |
float HGT_LLTW(reftime, forecast, z_LLTW, y, x) ; | |
HGT_LLTW:_FillValue = 1.e+20f ; | |
HGT_LLTW:center = "US National Weather Service - NCEP (WMC)" ; | |
HGT_LLTW:long_name = "Geopotential height" ; | |
HGT_LLTW:units = "gpm" ; | |
HGT_LLTW:level_indicator = 245 ; | |
HGT_LLTW:grid_number = 218 ; | |
HGT_LLTW:parameter_table_version = 2 ; | |
HGT_LLTW:parameter_number = 7 ; | |
HGT_LLTW:model = "MESO NAM Model (currently 12 km)" ; | |
HGT_LLTW:forecast_time_units = "hours" ; | |
HGT_LLTW:initial_time = "11/11/2016 (00:00)" ; | |
HGT_LLTW:coordinates = "rot lon lat" ; | |
float TMP_SFC(reftime, forecast, z_SFC, y, x) ; | |
TMP_SFC:_FillValue = 1.e+20f ; | |
TMP_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
TMP_SFC:long_name = "Temperature" ; | |
TMP_SFC:units = "K" ; | |
TMP_SFC:level_indicator = 1 ; | |
TMP_SFC:grid_number = 218 ; | |
TMP_SFC:parameter_table_version = 2 ; | |
TMP_SFC:parameter_number = 11 ; | |
TMP_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
TMP_SFC:forecast_time_units = "hours" ; | |
TMP_SFC:initial_time = "11/11/2016 (00:00)" ; | |
TMP_SFC:coordinates = "rot lon lat" ; | |
float TMP_TRO(reftime, forecast, z_TRO, y, x) ; | |
TMP_TRO:_FillValue = 1.e+20f ; | |
TMP_TRO:center = "US National Weather Service - NCEP (WMC)" ; | |
TMP_TRO:long_name = "Temperature" ; | |
TMP_TRO:units = "K" ; | |
TMP_TRO:level_indicator = 7 ; | |
TMP_TRO:grid_number = 218 ; | |
TMP_TRO:parameter_table_version = 2 ; | |
TMP_TRO:parameter_number = 11 ; | |
TMP_TRO:model = "MESO NAM Model (currently 12 km)" ; | |
TMP_TRO:forecast_time_units = "hours" ; | |
TMP_TRO:initial_time = "11/11/2016 (00:00)" ; | |
TMP_TRO:coordinates = "rot lon lat" ; | |
float TMP_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
TMP_ISBL:_FillValue = 1.e+20f ; | |
TMP_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
TMP_ISBL:long_name = "Temperature" ; | |
TMP_ISBL:units = "K" ; | |
TMP_ISBL:level_indicator = 100 ; | |
TMP_ISBL:grid_number = 218 ; | |
TMP_ISBL:parameter_table_version = 2 ; | |
TMP_ISBL:parameter_number = 11 ; | |
TMP_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
TMP_ISBL:forecast_time_units = "hours" ; | |
TMP_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
TMP_ISBL:coordinates = "rot lon lat" ; | |
float TMP_HTGL(reftime, forecast, z_HTGL1, y, x) ; | |
TMP_HTGL:_FillValue = 1.e+20f ; | |
TMP_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
TMP_HTGL:long_name = "Temperature" ; | |
TMP_HTGL:units = "K" ; | |
TMP_HTGL:level_indicator = 105 ; | |
TMP_HTGL:grid_number = 218 ; | |
TMP_HTGL:parameter_table_version = 2 ; | |
TMP_HTGL:parameter_number = 11 ; | |
TMP_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
TMP_HTGL:forecast_time_units = "hours" ; | |
TMP_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
TMP_HTGL:coordinates = "rot lon lat" ; | |
float TMP_SPDY(reftime, forecast, z_SPDY, y, x) ; | |
TMP_SPDY:_FillValue = 1.e+20f ; | |
TMP_SPDY:center = "US National Weather Service - NCEP (WMC)" ; | |
TMP_SPDY:long_name = "Temperature" ; | |
TMP_SPDY:units = "K" ; | |
TMP_SPDY:level_indicator = 116 ; | |
TMP_SPDY:grid_number = 218 ; | |
TMP_SPDY:parameter_table_version = 2 ; | |
TMP_SPDY:parameter_number = 11 ; | |
TMP_SPDY:model = "MESO NAM Model (currently 12 km)" ; | |
TMP_SPDY:forecast_time_units = "hours" ; | |
TMP_SPDY:initial_time = "11/11/2016 (00:00)" ; | |
TMP_SPDY:coordinates = "rot lon lat" ; | |
float VIS_SFC(reftime, forecast, z_SFC, y, x) ; | |
VIS_SFC:_FillValue = 1.e+20f ; | |
VIS_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
VIS_SFC:long_name = "Visibility" ; | |
VIS_SFC:units = "m" ; | |
VIS_SFC:level_indicator = 1 ; | |
VIS_SFC:grid_number = 218 ; | |
VIS_SFC:parameter_table_version = 2 ; | |
VIS_SFC:parameter_number = 20 ; | |
VIS_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
VIS_SFC:forecast_time_units = "hours" ; | |
VIS_SFC:initial_time = "11/11/2016 (00:00)" ; | |
VIS_SFC:coordinates = "rot lon lat" ; | |
float UGRD_MWSL(reftime, forecast, z_MWSL, y, x) ; | |
UGRD_MWSL:_FillValue = 1.e+20f ; | |
UGRD_MWSL:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_MWSL:long_name = "u-component of wind" ; | |
UGRD_MWSL:units = "m/s" ; | |
UGRD_MWSL:level_indicator = 6 ; | |
UGRD_MWSL:grid_number = 218 ; | |
UGRD_MWSL:parameter_table_version = 2 ; | |
UGRD_MWSL:parameter_number = 33 ; | |
UGRD_MWSL:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_MWSL:forecast_time_units = "hours" ; | |
UGRD_MWSL:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_MWSL:coordinates = "rot lon lat" ; | |
float UGRD_TRO(reftime, forecast, z_TRO, y, x) ; | |
UGRD_TRO:_FillValue = 1.e+20f ; | |
UGRD_TRO:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_TRO:long_name = "u-component of wind" ; | |
UGRD_TRO:units = "m/s" ; | |
UGRD_TRO:level_indicator = 7 ; | |
UGRD_TRO:grid_number = 218 ; | |
UGRD_TRO:parameter_table_version = 2 ; | |
UGRD_TRO:parameter_number = 33 ; | |
UGRD_TRO:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_TRO:forecast_time_units = "hours" ; | |
UGRD_TRO:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_TRO:coordinates = "rot lon lat" ; | |
float UGRD_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
UGRD_ISBL:_FillValue = 1.e+20f ; | |
UGRD_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_ISBL:long_name = "u-component of wind" ; | |
UGRD_ISBL:units = "m/s" ; | |
UGRD_ISBL:level_indicator = 100 ; | |
UGRD_ISBL:grid_number = 218 ; | |
UGRD_ISBL:parameter_table_version = 2 ; | |
UGRD_ISBL:parameter_number = 33 ; | |
UGRD_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_ISBL:forecast_time_units = "hours" ; | |
UGRD_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_ISBL:coordinates = "rot lon lat" ; | |
float UGRD_HTGL(reftime, forecast, z_HTGL2, y, x) ; | |
UGRD_HTGL:_FillValue = 1.e+20f ; | |
UGRD_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_HTGL:long_name = "u-component of wind" ; | |
UGRD_HTGL:units = "m/s" ; | |
UGRD_HTGL:level_indicator = 105 ; | |
UGRD_HTGL:grid_number = 218 ; | |
UGRD_HTGL:parameter_table_version = 2 ; | |
UGRD_HTGL:parameter_number = 33 ; | |
UGRD_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_HTGL:forecast_time_units = "hours" ; | |
UGRD_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_HTGL:coordinates = "rot lon lat" ; | |
float UGRD_SPDY(reftime, forecast, z_SPDY, y, x) ; | |
UGRD_SPDY:_FillValue = 1.e+20f ; | |
UGRD_SPDY:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_SPDY:long_name = "u-component of wind" ; | |
UGRD_SPDY:units = "m/s" ; | |
UGRD_SPDY:level_indicator = 116 ; | |
UGRD_SPDY:grid_number = 218 ; | |
UGRD_SPDY:parameter_table_version = 2 ; | |
UGRD_SPDY:parameter_number = 33 ; | |
UGRD_SPDY:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_SPDY:forecast_time_units = "hours" ; | |
UGRD_SPDY:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_SPDY:coordinates = "rot lon lat" ; | |
float UGRD_PBL(reftime, forecast, z_PBL, y, x) ; | |
UGRD_PBL:_FillValue = 1.e+20f ; | |
UGRD_PBL:center = "US National Weather Service - NCEP (WMC)" ; | |
UGRD_PBL:long_name = "u-component of wind" ; | |
UGRD_PBL:units = "m/s" ; | |
UGRD_PBL:level_indicator = 220 ; | |
UGRD_PBL:grid_number = 218 ; | |
UGRD_PBL:parameter_table_version = 2 ; | |
UGRD_PBL:parameter_number = 33 ; | |
UGRD_PBL:model = "MESO NAM Model (currently 12 km)" ; | |
UGRD_PBL:forecast_time_units = "hours" ; | |
UGRD_PBL:initial_time = "11/11/2016 (00:00)" ; | |
UGRD_PBL:coordinates = "rot lon lat" ; | |
float VGRD_MWSL(reftime, forecast, z_MWSL, y, x) ; | |
VGRD_MWSL:_FillValue = 1.e+20f ; | |
VGRD_MWSL:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_MWSL:long_name = "v-component of wind" ; | |
VGRD_MWSL:units = "m/s" ; | |
VGRD_MWSL:level_indicator = 6 ; | |
VGRD_MWSL:grid_number = 218 ; | |
VGRD_MWSL:parameter_table_version = 2 ; | |
VGRD_MWSL:parameter_number = 34 ; | |
VGRD_MWSL:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_MWSL:forecast_time_units = "hours" ; | |
VGRD_MWSL:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_MWSL:coordinates = "rot lon lat" ; | |
float VGRD_TRO(reftime, forecast, z_TRO, y, x) ; | |
VGRD_TRO:_FillValue = 1.e+20f ; | |
VGRD_TRO:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_TRO:long_name = "v-component of wind" ; | |
VGRD_TRO:units = "m/s" ; | |
VGRD_TRO:level_indicator = 7 ; | |
VGRD_TRO:grid_number = 218 ; | |
VGRD_TRO:parameter_table_version = 2 ; | |
VGRD_TRO:parameter_number = 34 ; | |
VGRD_TRO:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_TRO:forecast_time_units = "hours" ; | |
VGRD_TRO:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_TRO:coordinates = "rot lon lat" ; | |
float VGRD_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
VGRD_ISBL:_FillValue = 1.e+20f ; | |
VGRD_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_ISBL:long_name = "v-component of wind" ; | |
VGRD_ISBL:units = "m/s" ; | |
VGRD_ISBL:level_indicator = 100 ; | |
VGRD_ISBL:grid_number = 218 ; | |
VGRD_ISBL:parameter_table_version = 2 ; | |
VGRD_ISBL:parameter_number = 34 ; | |
VGRD_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_ISBL:forecast_time_units = "hours" ; | |
VGRD_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_ISBL:coordinates = "rot lon lat" ; | |
float VGRD_HTGL(reftime, forecast, z_HTGL2, y, x) ; | |
VGRD_HTGL:_FillValue = 1.e+20f ; | |
VGRD_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_HTGL:long_name = "v-component of wind" ; | |
VGRD_HTGL:units = "m/s" ; | |
VGRD_HTGL:level_indicator = 105 ; | |
VGRD_HTGL:grid_number = 218 ; | |
VGRD_HTGL:parameter_table_version = 2 ; | |
VGRD_HTGL:parameter_number = 34 ; | |
VGRD_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_HTGL:forecast_time_units = "hours" ; | |
VGRD_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_HTGL:coordinates = "rot lon lat" ; | |
float VGRD_SPDY(reftime, forecast, z_SPDY, y, x) ; | |
VGRD_SPDY:_FillValue = 1.e+20f ; | |
VGRD_SPDY:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_SPDY:long_name = "v-component of wind" ; | |
VGRD_SPDY:units = "m/s" ; | |
VGRD_SPDY:level_indicator = 116 ; | |
VGRD_SPDY:grid_number = 218 ; | |
VGRD_SPDY:parameter_table_version = 2 ; | |
VGRD_SPDY:parameter_number = 34 ; | |
VGRD_SPDY:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_SPDY:forecast_time_units = "hours" ; | |
VGRD_SPDY:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_SPDY:coordinates = "rot lon lat" ; | |
float VGRD_PBL(reftime, forecast, z_PBL, y, x) ; | |
VGRD_PBL:_FillValue = 1.e+20f ; | |
VGRD_PBL:center = "US National Weather Service - NCEP (WMC)" ; | |
VGRD_PBL:long_name = "v-component of wind" ; | |
VGRD_PBL:units = "m/s" ; | |
VGRD_PBL:level_indicator = 220 ; | |
VGRD_PBL:grid_number = 218 ; | |
VGRD_PBL:parameter_table_version = 2 ; | |
VGRD_PBL:parameter_number = 34 ; | |
VGRD_PBL:model = "MESO NAM Model (currently 12 km)" ; | |
VGRD_PBL:forecast_time_units = "hours" ; | |
VGRD_PBL:initial_time = "11/11/2016 (00:00)" ; | |
VGRD_PBL:coordinates = "rot lon lat" ; | |
float VVEL_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
VVEL_ISBL:_FillValue = 1.e+20f ; | |
VVEL_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
VVEL_ISBL:long_name = "Pressure vertical velocity" ; | |
VVEL_ISBL:units = "Pa/s" ; | |
VVEL_ISBL:level_indicator = 100 ; | |
VVEL_ISBL:grid_number = 218 ; | |
VVEL_ISBL:parameter_table_version = 2 ; | |
VVEL_ISBL:parameter_number = 39 ; | |
VVEL_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
VVEL_ISBL:forecast_time_units = "hours" ; | |
VVEL_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
VVEL_ISBL:coordinates = "rot lon lat" ; | |
float DZDT_ISBL(reftime, forecast, z_ISBL2, y, x) ; | |
DZDT_ISBL:_FillValue = 1.e+20f ; | |
DZDT_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
DZDT_ISBL:long_name = "Geometric vertical velocity" ; | |
DZDT_ISBL:units = "m/s" ; | |
DZDT_ISBL:level_indicator = 100 ; | |
DZDT_ISBL:grid_number = 218 ; | |
DZDT_ISBL:parameter_table_version = 2 ; | |
DZDT_ISBL:parameter_number = 40 ; | |
DZDT_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
DZDT_ISBL:forecast_time_units = "hours" ; | |
DZDT_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
DZDT_ISBL:coordinates = "rot lon lat" ; | |
float RH_0DEG(reftime, forecast, z_0DEG, y, x) ; | |
RH_0DEG:_FillValue = 1.e+20f ; | |
RH_0DEG:center = "US National Weather Service - NCEP (WMC)" ; | |
RH_0DEG:long_name = "Relative humidity" ; | |
RH_0DEG:units = "%" ; | |
RH_0DEG:level_indicator = 4 ; | |
RH_0DEG:grid_number = 218 ; | |
RH_0DEG:parameter_table_version = 2 ; | |
RH_0DEG:parameter_number = 52 ; | |
RH_0DEG:model = "MESO NAM Model (currently 12 km)" ; | |
RH_0DEG:forecast_time_units = "hours" ; | |
RH_0DEG:initial_time = "11/11/2016 (00:00)" ; | |
RH_0DEG:coordinates = "rot lon lat" ; | |
float RH_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
RH_ISBL:_FillValue = 1.e+20f ; | |
RH_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
RH_ISBL:long_name = "Relative humidity" ; | |
RH_ISBL:units = "%" ; | |
RH_ISBL:level_indicator = 100 ; | |
RH_ISBL:grid_number = 218 ; | |
RH_ISBL:parameter_table_version = 2 ; | |
RH_ISBL:parameter_number = 52 ; | |
RH_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
RH_ISBL:forecast_time_units = "hours" ; | |
RH_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
RH_ISBL:coordinates = "rot lon lat" ; | |
float RH_HTGL(reftime, forecast, z_HTGL, y, x) ; | |
RH_HTGL:_FillValue = 1.e+20f ; | |
RH_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
RH_HTGL:long_name = "Relative humidity" ; | |
RH_HTGL:units = "%" ; | |
RH_HTGL:level_indicator = 105 ; | |
RH_HTGL:grid_number = 218 ; | |
RH_HTGL:parameter_table_version = 2 ; | |
RH_HTGL:parameter_number = 52 ; | |
RH_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
RH_HTGL:level = 2 ; | |
RH_HTGL:forecast_time_units = "hours" ; | |
RH_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
RH_HTGL:coordinates = "rot lon lat" ; | |
float RH_SIGY(reftime, forecast, z_SIGY, y, x) ; | |
RH_SIGY:_FillValue = 1.e+20f ; | |
RH_SIGY:center = "US National Weather Service - NCEP (WMC)" ; | |
RH_SIGY:long_name = "Relative humidity" ; | |
RH_SIGY:units = "%" ; | |
RH_SIGY:level_indicator = 108 ; | |
RH_SIGY:grid_number = 218 ; | |
RH_SIGY:parameter_table_version = 2 ; | |
RH_SIGY:parameter_number = 52 ; | |
RH_SIGY:model = "MESO NAM Model (currently 12 km)" ; | |
RH_SIGY:level = 33, 100 ; | |
RH_SIGY:forecast_time_units = "hours" ; | |
RH_SIGY:initial_time = "11/11/2016 (00:00)" ; | |
RH_SIGY:coordinates = "rot lon lat" ; | |
float RH_SPDY(reftime, forecast, z_SPDY, y, x) ; | |
RH_SPDY:_FillValue = 1.e+20f ; | |
RH_SPDY:center = "US National Weather Service - NCEP (WMC)" ; | |
RH_SPDY:long_name = "Relative humidity" ; | |
RH_SPDY:units = "%" ; | |
RH_SPDY:level_indicator = 116 ; | |
RH_SPDY:grid_number = 218 ; | |
RH_SPDY:parameter_table_version = 2 ; | |
RH_SPDY:parameter_number = 52 ; | |
RH_SPDY:model = "MESO NAM Model (currently 12 km)" ; | |
RH_SPDY:forecast_time_units = "hours" ; | |
RH_SPDY:initial_time = "11/11/2016 (00:00)" ; | |
RH_SPDY:coordinates = "rot lon lat" ; | |
float PWAT_EATM(reftime, forecast, z_EATM, y, x) ; | |
PWAT_EATM:_FillValue = 1.e+20f ; | |
PWAT_EATM:center = "US National Weather Service - NCEP (WMC)" ; | |
PWAT_EATM:long_name = "Precipitable water" ; | |
PWAT_EATM:units = "kg/m^2" ; | |
PWAT_EATM:level_indicator = 200 ; | |
PWAT_EATM:grid_number = 218 ; | |
PWAT_EATM:parameter_table_version = 2 ; | |
PWAT_EATM:parameter_number = 54 ; | |
PWAT_EATM:model = "MESO NAM Model (currently 12 km)" ; | |
PWAT_EATM:level = 0 ; | |
PWAT_EATM:forecast_time_units = "hours" ; | |
PWAT_EATM:initial_time = "11/11/2016 (00:00)" ; | |
PWAT_EATM:coordinates = "rot lon lat" ; | |
float TCDC_EATM(reftime, forecast, z_EATM, y, x) ; | |
TCDC_EATM:_FillValue = 1.e+20f ; | |
TCDC_EATM:center = "US National Weather Service - NCEP (WMC)" ; | |
TCDC_EATM:long_name = "Total cloud cover" ; | |
TCDC_EATM:units = "%" ; | |
TCDC_EATM:level_indicator = 200 ; | |
TCDC_EATM:grid_number = 218 ; | |
TCDC_EATM:parameter_table_version = 2 ; | |
TCDC_EATM:parameter_number = 71 ; | |
TCDC_EATM:model = "MESO NAM Model (currently 12 km)" ; | |
TCDC_EATM:level = 0 ; | |
TCDC_EATM:forecast_time_units = "hours" ; | |
TCDC_EATM:initial_time = "11/11/2016 (00:00)" ; | |
TCDC_EATM:coordinates = "rot lon lat" ; | |
float SHTFL_SFC(reftime, forecast, z_SFC, y, x) ; | |
SHTFL_SFC:_FillValue = 1.e+20f ; | |
SHTFL_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
SHTFL_SFC:long_name = "Sensible heat flux" ; | |
SHTFL_SFC:units = "W/m^2" ; | |
SHTFL_SFC:level_indicator = 1 ; | |
SHTFL_SFC:grid_number = 218 ; | |
SHTFL_SFC:parameter_table_version = 2 ; | |
SHTFL_SFC:parameter_number = 122 ; | |
SHTFL_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
SHTFL_SFC:forecast_time_units = "hours" ; | |
SHTFL_SFC:initial_time = "11/11/2016 (00:00)" ; | |
SHTFL_SFC:coordinates = "rot lon lat" ; | |
float TKE_ISBL(reftime, forecast, z_ISBL1, y, x) ; | |
TKE_ISBL:_FillValue = 1.e+20f ; | |
TKE_ISBL:center = "US National Weather Service - NCEP (WMC)" ; | |
TKE_ISBL:long_name = "Turbulent kinetic energy" ; | |
TKE_ISBL:units = "J/kg" ; | |
TKE_ISBL:level_indicator = 100 ; | |
TKE_ISBL:grid_number = 218 ; | |
TKE_ISBL:parameter_table_version = 2 ; | |
TKE_ISBL:parameter_number = 158 ; | |
TKE_ISBL:model = "MESO NAM Model (currently 12 km)" ; | |
TKE_ISBL:forecast_time_units = "hours" ; | |
TKE_ISBL:initial_time = "11/11/2016 (00:00)" ; | |
TKE_ISBL:coordinates = "rot lon lat" ; | |
float DSWRF_SFC(reftime, forecast, z_SFC, y, x) ; | |
DSWRF_SFC:_FillValue = 1.e+20f ; | |
DSWRF_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
DSWRF_SFC:long_name = "Downward short wave flux" ; | |
DSWRF_SFC:units = "W/m^2" ; | |
DSWRF_SFC:level_indicator = 1 ; | |
DSWRF_SFC:grid_number = 218 ; | |
DSWRF_SFC:parameter_table_version = 2 ; | |
DSWRF_SFC:parameter_number = 204 ; | |
DSWRF_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
DSWRF_SFC:forecast_time_units = "hours" ; | |
DSWRF_SFC:initial_time = "11/11/2016 (00:00)" ; | |
DSWRF_SFC:coordinates = "rot lon lat" ; | |
float DLWRF_SFC(reftime, forecast, z_SFC, y, x) ; | |
DLWRF_SFC:_FillValue = 1.e+20f ; | |
DLWRF_SFC:center = "US National Weather Service - NCEP (WMC)" ; | |
DLWRF_SFC:long_name = "Downward long wave flux" ; | |
DLWRF_SFC:units = "W/m^2" ; | |
DLWRF_SFC:level_indicator = 1 ; | |
DLWRF_SFC:grid_number = 218 ; | |
DLWRF_SFC:parameter_table_version = 2 ; | |
DLWRF_SFC:parameter_number = 205 ; | |
DLWRF_SFC:model = "MESO NAM Model (currently 12 km)" ; | |
DLWRF_SFC:forecast_time_units = "hours" ; | |
DLWRF_SFC:initial_time = "11/11/2016 (00:00)" ; | |
DLWRF_SFC:coordinates = "rot lon lat" ; | |
float REFD_HTGL(reftime, forecast, z_HTGL3, y, x) ; | |
REFD_HTGL:_FillValue = 1.e+20f ; | |
REFD_HTGL:center = "US National Weather Service - NCEP (WMC)" ; | |
REFD_HTGL:long_name = "Derived radar reflectivity" ; | |
REFD_HTGL:units = "dbZ" ; | |
REFD_HTGL:level_indicator = 105 ; | |
REFD_HTGL:grid_number = 218 ; | |
REFD_HTGL:parameter_table_version = 129 ; | |
REFD_HTGL:parameter_number = 211 ; | |
REFD_HTGL:model = "MESO NAM Model (currently 12 km)" ; | |
REFD_HTGL:forecast_time_units = "hours" ; | |
REFD_HTGL:initial_time = "11/11/2016 (00:00)" ; | |
REFD_HTGL:coordinates = "rot lon lat" ; | |
float REFD_HYBL(reftime, forecast, z_HYBL, y, x) ; | |
REFD_HYBL:_FillValue = 1.e+20f ; | |
REFD_HYBL:center = "US National Weather Service - NCEP (WMC)" ; | |
REFD_HYBL:long_name = "Derived radar reflectivity" ; | |
REFD_HYBL:units = "dbZ" ; | |
REFD_HYBL:level_indicator = 109 ; | |
REFD_HYBL:grid_number = 218 ; | |
REFD_HYBL:parameter_table_version = 129 ; | |
REFD_HYBL:parameter_number = 211 ; | |
REFD_HYBL:model = "MESO NAM Model (currently 12 km)" ; | |
REFD_HYBL:level = 1 ; | |
REFD_HYBL:forecast_time_units = "hours" ; | |
REFD_HYBL:initial_time = "11/11/2016 (00:00)" ; | |
REFD_HYBL:coordinates = "rot lon lat" ; | |
float REFC_EATM(reftime, forecast, z_EATM, y, x) ; | |
REFC_EATM:_FillValue = 1.e+20f ; | |
REFC_EATM:center = "US National Weather Service - NCEP (WMC)" ; | |
REFC_EATM:long_name = "Maximum/Composite radar reflectivity" ; | |
REFC_EATM:units = "dbZ" ; | |
REFC_EATM:level_indicator = 200 ; | |
REFC_EATM:grid_number = 218 ; | |
REFC_EATM:parameter_table_version = 129 ; | |
REFC_EATM:parameter_number = 212 ; | |
REFC_EATM:model = "MESO NAM Model (currently 12 km)" ; | |
REFC_EATM:level = 0 ; | |
REFC_EATM:forecast_time_units = "hours" ; | |
REFC_EATM:initial_time = "11/11/2016 (00:00)" ; | |
REFC_EATM:coordinates = "rot lon lat" ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the basic thing I'm trying to do. | |
# The files are GRIBs, one for each forecast hour. | |
# This works just fine. The problem is that when I save the dataset and | |
# reopen it, the forecast dimension is automatically converted to datetime. | |
def load(reftime): | |
datasets = [] | |
for path in local_gribs(reftime): | |
forecast = re.search('awphys([0-9][0-9])', str(path)) | |
forecast = int(forecast[1]) | |
ds = xr.open_dataset(str(path), engine='pynio') | |
ds = preprocess(ds, reftime, forecast) | |
ds = ds.copy(deep=True) # free unused features and areas | |
datasets.append(ds) | |
return xr.concat(datasets, dim='forecast') | |
# This is the function I use to preprocess the Datasets. | |
def preprocess(ds, reftime, forecast): | |
'''Preprocess a dataset directly after it's been read from a GRIB. | |
''' | |
# Normalize the first format. | |
# This format occurs when reading a GRIB1 file with xarray and the PyNIO backend. | |
# Note `gridx_218` is the y coordinate, likewise `gridy_218` is the x coordinate. | |
if 'gridx_218' in ds.dims: | |
features = { | |
'DLWRF_218_SFC': 'DLWRF_SFC', 'DSWRF_218_SFC': 'DSWRF_SFC', | |
'PRES_218_SFC': 'PRES_SFC', 'PRES_218_HTGL': 'PRES_HTGL', | |
'PRES_218_MWSL': 'PRES_MWSL', 'PRES_218_TRO': 'PRES_TRO', | |
'T_CDC_218_EATM': 'TCDC_EATM', 'TMP_218_SPDY': 'TMP_SPDY', | |
'TMP_218_SFC': 'TMP_SFC', 'TMP_218_ISBL': 'TMP_ISBL', | |
'TMP_218_HTGL': 'TMP_HTGL', 'TMP_218_TRO': 'TMP_TRO', | |
'R_H_218_SIGY': 'RH_SIGY', 'R_H_218_SPDY': 'RH_SPDY', | |
'R_H_218_ISBL': 'RH_ISBL', 'R_H_218_HTGL': 'RH_HTGL', | |
'R_H_218_0DEG': 'RH_0DEG', 'U_GRD_218_SPDY': 'UGRD_SPDY', | |
'U_GRD_218_ISBL': 'UGRD_ISBL', 'U_GRD_218_HTGL': 'UGRD_HTGL', | |
'U_GRD_218_220': 'UGRD_PBL', 'U_GRD_218_MWSL': 'UGRD_MWSL', | |
'U_GRD_218_TRO': 'UGRD_TRO', 'V_GRD_218_SPDY': 'VGRD_SPDY', | |
'V_GRD_218_ISBL': 'VGRD_ISBL', 'V_GRD_218_HTGL': 'VGRD_HTGL', | |
'V_GRD_218_220': 'VGRD_PBL', 'V_GRD_218_MWSL': 'VGRD_MWSL', | |
'V_GRD_218_TRO': 'VGRD_TRO', 'V_VEL_218_ISBL': 'VVEL_ISBL', | |
'VIS_218_SFC': 'VIS_SFC', 'SHTFL_218_SFC': 'SHTFL_SFC', | |
'REFC_218_EATM': 'REFC_EATM', 'REFD_218_HTGL': 'REFD_HTGL', | |
'REFD_218_HYBL': 'REFD_HYBL', 'DZDT_218_ISBL': 'DZDT_ISBL', | |
'HGT_218_SFC': 'HGT_SFC', 'HGT_218_ISBL': 'HGT_ISBL', | |
'HGT_218_CBL': 'HGT_CBL', 'HGT_218_220': 'HGT_PBL', | |
'HGT_218_LLTW': 'HGT_LLTW', 'HGT_218_0DEG': 'HGT_0DEG', | |
'P_WAT_218_EATM': 'PWAT_EATM', 'TKE_218_ISBL': 'TKE_ISBL', | |
'gridx_218': 'y', 'gridy_218': 'x', | |
'gridlat_218': 'lat', 'gridlon_218': 'lon', | |
'gridrot_218': 'rot', 'lv_SPDY4': 'z_SPDY', | |
'lv_HTGL3': 'z_HTGL1', 'lv_HTGL5': 'z_HTGL2', | |
'lv_HTGL9': 'z_HTGL3', 'lv_ISBL2': 'z_ISBL1', | |
'lv_ISBL6': 'z_ISBL2', 'lv_ISBL7': 'z_ISBL3', | |
} | |
unwanted = [v for v in ds.data_vars if v not in features] | |
ds = ds.drop(unwanted) | |
ds = ds.rename(features) | |
for v in ('z_ISBL3', 'z_ISBL2', 'z_ISBL1'): | |
ds[v].data *= 100 | |
ds[v].attrs['units'] = 'Pa' | |
# Normalize the second format. | |
# This format occurs after the change from GRIB1 to GRIB2 (circa April 2017). | |
else: | |
features = { | |
'DLWRF_P0_L1_GLC0': 'DLWRF_SFC', 'DSWRF_P0_L1_GLC0': 'DSWRF_SFC', | |
'PRES_P0_L1_GLC0': 'PRES_SFC', 'PRES_P0_L103_GLC0': 'PRES_HTGL', | |
'PRES_P0_L6_GLC0': 'PRES_MWSL', 'PRES_P0_L7_GLC0': 'PRES_TRO', | |
'TCDC_P0_L200_GLC0': 'TCDC_EATM', 'TMP_P0_2L108_GLC0': 'TMP_SPDY', | |
'TMP_P0_L1_GLC0': 'TMP_SFC', 'TMP_P0_L100_GLC0': 'TMP_ISBL', | |
'TMP_P0_L103_GLC0': 'TMP_HTGL', 'TMP_P0_L7_GLC0': 'TMP_TRO', | |
'RH_P0_2L104_GLC0': 'RH_SIGY', 'RH_P0_2L108_GLC0': 'RH_SPDY', | |
'RH_P0_L100_GLC0': 'RH_ISBL', 'RH_P0_L103_GLC0': 'RH_HTGL', | |
'RH_P0_L4_GLC0': 'RH_0DEG', 'UGRD_P0_2L108_GLC0': 'UGRD_SPDY', | |
'UGRD_P0_L100_GLC0': 'UGRD_ISBL', 'UGRD_P0_L103_GLC0': 'UGRD_HTGL', | |
'UGRD_P0_L220_GLC0': 'UGRD_PBL', 'UGRD_P0_L6_GLC0': 'UGRD_MWSL', | |
'UGRD_P0_L7_GLC0': 'UGRD_TRO', 'VGRD_P0_2L108_GLC0': 'VGRD_SPDY', | |
'VGRD_P0_L100_GLC0': 'VGRD_ISBL', 'VGRD_P0_L103_GLC0': 'VGRD_HTGL', | |
'VGRD_P0_L220_GLC0': 'VGRD_PBL', 'VGRD_P0_L6_GLC0': 'VGRD_MWSL', | |
'VGRD_P0_L7_GLC0': 'VGRD_TRO', 'VVEL_P0_L100_GLC0': 'VVEL_ISBL', | |
'VIS_P0_L1_GLC0': 'VIS_SFC', 'SHTFL_P0_L1_GLC0': 'SHTFL_SFC', | |
'REFC_P0_L200_GLC0': 'REFC_EATM', 'REFD_P0_L103_GLC0': 'REFD_HTGL', | |
'REFD_P0_L105_GLC0': 'REFD_HYBL', 'DZDT_P0_L100_GLC0': 'DZDT_ISBL', | |
'HGT_P0_L1_GLC0': 'HGT_SFC', 'HGT_P0_L100_GLC0': 'HGT_ISBL', | |
'HGT_P0_L2_GLC0': 'HGT_CBL', 'HGT_P0_L220_GLC0': 'HGT_PBL', | |
'HGT_P0_L245_GLC0': 'HGT_LLTW', 'HGT_P0_L4_GLC0': 'HGT_0DEG', | |
'PWAT_P0_L200_GLC0': 'PWAT_EATM', 'TKE_P0_L100_GLC0': 'TKE_ISBL', | |
'xgrid_0': 'x', 'ygrid_0': 'y', | |
'gridlat_0': 'lat', 'gridlon_0': 'lon', | |
'gridrot_0': 'rot', 'lv_SPDL2': 'z_SPDY', | |
'lv_HTGL1': 'z_HTGL1', 'lv_HTGL3': 'z_HTGL2', | |
'lv_HTGL6': 'z_HTGL3', 'lv_ISBL0': 'z_ISBL1', | |
'lv_ISBL4': 'z_ISBL2', 'lv_ISBL5': 'z_ISBL3', | |
} | |
unwanted = [v for v in ds.data_vars if v not in features] | |
ds = ds.drop(unwanted) | |
ds = ds.rename(features) | |
# Subset the geographic region to a square area centered around Macon, GA. | |
ds = ds.isel(y=slice(63, 223, None), x=slice(355, 515, None)) | |
# Compute the coordinates for x and y | |
x, y = proj_coords(ds.lat.data, ds.lon.data) | |
ds = ds.assign_coords(x=x, y=y) | |
# Promote `rot` to a coordinate variable. | |
ds = ds.set_coords('rot') | |
# Add a z dimension to variables that don't have one. | |
for v in ds.data_vars: | |
if ds[v].dims == ('y', 'x'): | |
layer = ds[v].name.split('_')[1] | |
ds[v] = ds[v].expand_dims(f'z_{layer}') | |
# Create reftime and forecast dimensions. | |
ds = ds.assign_coords( | |
reftime=reftime, | |
forecast=forecast, | |
) | |
ds.forecast.attrs['units'] = f'hours since {reftime}' | |
for v in ds.data_vars: | |
ds[v] = ds[v].expand_dims(('reftime', 'forecast')) | |
return ds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment