U.S. Department of the Interior

U.S. Geological Survey

Open-File Report 2013–1015

Obtaining and Processing Daymet Data Using 

Python and ArcGIS

Obtaining and Processing Daymet Data 

Using Python and ArcGIS

By Stefanie Bohms

Open-File Report 2013–1015

U.S. Department of the Interior

U.S. Geological Survey
U.S. Department of the Interior

KEN SALAZAR, Secretary

U.S. Geological Survey

Marcia K. McNutt, Director

U.S. Geological Survey, Reston, Virginia: 2013

For more information on the USGS—the Federal source for science about the Earth, its natural and living 

resources, natural hazards, and the environment, visit http://www.usgs.gov or call 1–888–ASK–USGS.

For an overview of USGS information products, including maps, imagery, and publications, 

visit http://www.usgs.gov/pubprod

To order this and other USGS information products, visit http://store.usgs.gov

Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the 

U.S. Government.

Although this information product, for the most part, is in the public domain, it also may contain copyrighted materials 

as noted in the text. Permission to reproduce copyrighted items must be secured from the copyright owner.

Suggested citation:

Bohms, Stefanie, 2013, Obtaining and processing Daymet data using Python and ArcGIS: U.S. Geological Survey Open-File 

Report 2013–1015, 2 p.
iii

Contents

Purpose............................................................................................................................................................1

Data Sets.........................................................................................................................................................1

Data Processing.............................................................................................................................................1

Step 1: Download Daymet tiles...........................................................................................................1

Step 2: Convert Netcdf file to raster file............................................................................................1

Step 3: Mosaic raster files to needed extent ...................................................................................2

Tips ...................................................................................................................................................................2

References......................................................................................................................................................2

Purpose

The purpose of this document is to introduce a set of python scripts that automate the process of downloading and mosaicking daily Daymet data for the entire conterminous United States (CONUS). The scripts can be used for any number of Daymet 

tiles.

Data Sets

The data set used is the Daily Gridded Surface Data from the Daymet website (Thornton and others, http://daymet.ornl.gov/

gridded). The provided ‘Daymet_Scripts.zip’ folder contains three python scripts, a readme file, and an example text file with all 

daymet TileIDs for the CONUS. The TileIDs refer to an identifier number for each 2 degree x 2 degree tile provided in the data 

set.

Data Processing

Step 1: Download Daymet tiles (netcdf files)

The first step is to download the required tiles in netcdf (.nc) format. The first script (1_DownloadTiles.py) downloads 

Daymet tiles; for example, the whole CONUS. One requirement is to have wget utility installed on the system. This utility is 

available for Microsoft Windows® at the GNU Wget website (Free Software Foundation, Inc., http://gnuwin32.sourceforge.net/

packages/wget.htm). To help with a large number of tiles, a list of tiles is provided as a text file for use. The script will take the 

Daymet TileIDs in the text file and download the tiles. After executing the script, the following input parameters must be entered 

on prompt:

1. Output path (for example: D:/daymet).

2. Year (YYYY).

3. Output path for tile text file (for example: D:/daymet/tiles.txt).

4. Parameter type given by Daymet (for example: tmin, tmax, prcp).

Step 2: Convert netcdf file to raster file

After the individual tiles are downloaded, the second script (2_NetcdfToRaster.py) converts the netcdf file to raster (geotiff) format for each day. Either ArcGIS 10.0 or ArcGIS 10.1 are required. The script loops through each netcdf file and creates 

separate raster files using the SelectByDimension Tool from ArcGIS. After executing the script, the following input parameters 

must be entered on prompt:

Obtaining and Processing Daymet Data Using Python 

and ArcGIS

By Stefanie Bohms1

 1Stinger Ghaffarian Technologies (SGT, Inc.), Contractor to the U.S. Geological Survey (USGS) Earth Resources 

Observation and Science (EROS) Center, 47914 252nd St, Sioux Falls, SD 57198, sbohms@usgs.gov
2 Obtaining and Processing Daymet Data Using Python and ArcGIS

1. Output path (for example: D:/daymet).

2. Year (YYYY).

3. Output path for tile text file (for example: D:/daymet/tiles.txt).

4. Parameter type given by Daymet (for example: tmin, tmax, prcp).

Step 3: Mosaic raster files to needed extent

The last step is to mosaic the raster files together in order to create one file for the entire U.S. extent. ArcGIS 10.1 is 

required for the SetMosaicDatasetProperties_management tool to mosaic more than the default number of inputs. After executing the script, the following input parameters must be entered on prompt:

1. Output path (for example: D:/daymet).

2. Year (YYYY).

3. Output path for tile text file (for example: D:/daymet/tiles.txt).

4. Parameter type given by Daymet (for example: tmin, tmax, prcp).

5. A geodatabase name of your choice.

6. Start day number (day 1 = 0, day 2 = 1, and so on).

Tips

Most of the time is spent mosaicking the daily raster files; this is a factor to consider if there is a tight deadline. One year, 

with 365 days for all 325 tiles in the United States, is about 20 Gigabyte (GB) and reduces to around 2 GB when all mosaicked. 

It is also recommended to use the Command Prompt for running these scripts. When choosing an output path, make sure there 

are no spaces in the folder names, otherwise Python will not be able to read the file path and will crash. If step 3 produces a 

tif file with a small file size (approximately 5 Kilobyte), please run script again until the file size is appropriate. The reason is 

unknown at this point.

References

Thornton, P.E., Thornton, M.M., Mayer, B.W., Wilhelmi, N., Wei, Y., and Cook, R.B., 2012, Daymet—Daily surface weather on 

a 1 km grid for North America,1980–2011: Oak Ridge, Tennessee, Oak Ridge National Laboratory Distributed Active Archive 

Center, accessed December 14, 2012, at http://daymet.ornl.gov/gridded.

Free Software Foundation, Inc., 2012, GNU Wget: Boston, Ma, Free Software Foundation, Inc., accessed December 14, 2012, at 

http://gnuwin32.sourceforge.net/packages/wget.htm.

Publishing support provided by:

Rolla Publishing Service Center 

For more information concerning this publication, contact:

U.S. Geological Survey Earth Resources Observation and Science 

(EROS) Center

47914 252nd Street, Sioux Falls, South Dakota 57198

(605) 594-6151

Or visit the EROS Center Web site at:

http://eros.usgs.gov/

Stefanie Bohms—Obtaining and Processing Daymet Data Using Python and ArcGIS—Open-File Report 2013–1015