Python Methods to Derive a Seasonal Mean from Daymet Data - Reading/Writing netCDF
Author: ORNL DAAC
Date: February 28, 2018
Contact for ORNL DAAC: email@example.com
Keywords: Daymet, Python, netCDF, THREDDS
These tutorials demonstrate how to use the Python netCDF4 and numpy modules to work with a dataset in netCDF file format using N-dimensional array objects. Python numpy array methods are shown that open and subset a temporal range from a gridded multidimentional netCDF file. The example uses data from the maximum temperature variables of a dataset (Daymet) that contain daily gridded meteorologic data. In the first tutorial, a summer average maximum temperature is created and the results saved into a new netCDF file. A second tutorial condenses introductory information and demonstates how to loop through more than one year of data.
Spatial subsets of the North American Daymet dataset daily data: https://daymet.ornl.gov.
For these tutorials, spatial subsets were obtained from the ORNL DAAC's THREDDS netCDF Subset Service (NCSS). A tutorial of the NCSS is available here under the "Gridded Subsets" tab: .
You can download the 2015 maximum temperature Daymet subset data used in these tutorials by pasting the following HTTP GET NCSS Request URL into a browser:
Daymet subset data for 2016 can be downloaded by updating the URL above to the 2016 dataset path and changing to 2016 in the time_start and time_end parameters.
Python 2.7 or later. Python modules: netCDF4, numpy, matplotlib, pylab, datetime