ua-snap / wrf_utils

snap scripts for working with the wrf output downscaled data products from the CSC
2 stars 0 forks source link

[ Hourly Stacking ] Checklist and Notes #1

Open EarthScientist opened 7 years ago

EarthScientist commented 7 years ago

These are simply points that need to be examined before moving forward in a significant way. Refer to the check-listed issues by number in the comments for consensus and keeping us all up-to-date. I assigned the 3 of us that are related to this effort to keep us all on the same page, this is not a call to action, though any input is greatly appreciated. :)

--> A current set of largely untested stacked data for the PCPT variable is located here: /workspace/Shared/Tech_Projects/wrf_data/project_data/wrf/hourly/pcpt

THE LIST:
EarthScientist commented 7 years ago

If using Python to examine the stacked files (which is HIGHLY recommended currently), here are a couple of snippets to show how to work with the outputs using xarray, dask, toolz

make sure you have the right packages installed in your virtualenv pip install xarray dask toolz

import xarray as xr
import os

data_path = '/workspace/Shared/Tech_Projects/wrf_data/project_data/wrf/hourly/pcpt'
os.chdir( data_path )

#"open" all the chronological files as a single unit using mfdataset
ds = xr.open_mfdataset( '*.nc' ) # use a wildcard to grab all the files for this series

# OR just read in one...
ds1 = xr.open_dataset( 'PCPT_wrf_hour_1979.nc' )

# get to the variable data
var_data = ds1[ 'PCPT' ]

# same logic goes for time
time_data = ds1[ 'time' ]

# we can get attributes at different levels
# current attrs are mostly derived from the input files stacked, with a couple of additions
print( ds1.attrs ) # global attrs
print( ds1.PCPT.attrs ) # local variable attrs
print( ds1.time.attrs ) # time variable attrs
EarthScientist commented 7 years ago

WRF data output