CCR logo

Nelson Home | UW Home | My UW | Map

click to support CCR

Get the latest on UW-Madison's COVID-19 Response
View updates to campus operations, information, and planning: Learn more

ABOUT
  • About CCR
  • Mission
  • Bryson Scholarship
  • Support CCR
  • Affiliated Institutions
  • Contact
PEOPLE
  • Meet the Director
  • Faculty, Scientists and Researchers
  • Administrators
  • Postdoctoral Scientists
  • Students
  • Affiliates
  • Climate Change Experts
  • Emeritus
NEWS
  • News Archive
  • Research Spotlight
EVENTS
  • CPEP Seminars
  • Climate Change Symposium
  • AOS Colloquium Series
  • Weston Roundtable Series
  • Past Events
CPEP
  • CPEP Seminars
  • Bryson Professors
  • Postdoctoral Fellows and Students
  • Seed Grants
RESEARCH
  • Publications
  • Carbon Cycling
  • Climate Impacts and Vulnerability
  • Climate Dynamics
  • Oceanography and Limnology
  • Past Climates
  • Surface-Atmosphere Feedbacks
RESOURCES
  • Visualization and Tools
  • Data
  • Scripts
  • Facilities and Equipment
  • Climate Jobs
click to toggle subnavRELATED LINKS
RESOURCES
Visualizations and Tools »
Data »
Scripts »
Facilities and Equipment »
Climate Jobs »

GrADS

Using XDFOPEN

Maps and Graphs | Significance Scripts | Managing Output | Using XDFOPEN | Creating Multiple Maps

The XDFOPEN command is used to open netCDF files when you are opening several files at once that have different time indices or when there is some problem with the file metadata(i.e., lat, lon, time variables).

Multiple Files Open at Once

You may have more than one file open in GrADS at the same time. Files are identified by the order in which they are opened: file 1 is the first file opened, and so on. Files that are opened at the same time should have the same values for coordinate variables. For example, if you try to use data from two files with different time indices, GrADS will give an error message similar to the following:

>d prectmm.1 - prectmm.2

Data Request Warning:  Request beyond file limits
Entire grid contents are set to missing data
Dimension ranges are:  X = 1 48  Y = 1 40  Z = 1 1  T = 1746275
Warning issued for variable = prectmm.2
Cannot contour grid - all undefined values

To get around such a problem, you can use xdfopen to open files with different time indices. For example, consider these two files: ha.F1.6k.mone486605.nc and ha.F1.6kFix.mone461470.nc.

When you open up ha.F1.6k.mone486605.nc in GrADS, you can see that the GrADS time index begins at 00Z11FEB479 (use the q time command), whereas the time index of ha.F1.6kFix.mone461470.nc begins at 00Z22JUN454.

If you try to use functions (e.g., oromask, aave) on variables from both files, GrADS will give you an error message as shown above because the time indices of the two files are different. We need to make GrADS believe the time indices in the two files are the same by creating XDF files to "dummy" the time variables for the two files. We will use the time index from ha.F1.6k.mone486605.nc to create a XDF file for ha.F1.6kFix.mone461470.nc. This will give the two files the same time indices and will allow you to work with both files at the same time.

Here are the contents of two sample XDF files.

XDF File for ha.F1.6kFix.mone461470.nc ("xdf6kfix"):
*DSET path to data
DSET /grove3/iesuw/foam/ha.F1.6kFix.mone461470.nc
* TDEF T_Dimension_Name T_Count LINEAR First_T_Value T_Step
TDEF time 12 LINEAR 00Z11FEB479 30DY

XDF File for ha.F1.6k.mone486605.nc ("xdf6k"):
*DSET path to data
DSET /grove3/iesuw/foam/ha.F1.6k.mone486605.nc
* TDEF T_Dimension_Name T_Count LINEAR First_T_Value T_Step
TDEF time 12 LINEAR 00Z11FEB479 30DY

How do you use the xdf files? Say the first is named "xdf6kfix" and the second is "xdf6k". In your script, in lieu of using sdfopen /path/filename, simply use:

xdfopen xdf6kfix

xdfopen xdf6k

File Metadata

GrADS is very picky about the netCDF coordinate variables (such as time, latitude, longitude, level). All coordinate variables must be COARDS-compliant. If you open the data set and get a message like, Data has no discernable x-coordinate, there is a problem with the file metadata. You may be able to fix the metadata using NCO or some other netCDF utility, or you may be able to read the offending file using the xdfopen commmand.

For example, in some of the CSM files (e.g., csmatm.6k.seae00100049.nc), ilev is the first vertical coordinate given, whereas lev is the correct vertical coordinate. GrADS uses the first coordinate variable that is defined vertically as the vertical coordinate. To make GrADS use lev instead of ilev, you need to create a xdf file for the offending netCDF file.

EXAMPLE:

DSET /grove3/iesuw/csm/csmatm.6k.seae00100049.nc
ZDEF lev

That's all you need to put in the xdf file. DSET tells GrADS where the file is, and ZDEF defines the vertical coordinate as the variable lev in the file.

click to visit the Nelson website
click to visit Nelson on Facebook click to visit Nelson on Twitter

CONTACT US:


Nelson Institute Center for Climatic Research
University of Wisconsin-Madison
1225 W. Dayton St.
Madison, WI 53706 USA
(608) 262-2839
(608) 263-4190 (FAX)

PARTNERSHIPS



  • Support CCR
  • CCR affiliates
University of Wisconsin Madison logo
Copyright © 2021 The Board of Regents of the University of Wisconsin System. Feedback, questions or accessibility issues: