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 »

NCO

NCRENAME

NCEA | NCRCAT | NCKS | NCDIFF | NCRENAME | NCRCAT | NCDTRND | ORO

Ncrename is used to rename variables in a netCDF file.

EXAMPLE:

In many CCR files, precipitation-evaporation is named P-E. However, GrADS and many other software packages will not recognize variables with a minus sign in them. So in order to look at P-E, it must be renamed.

The following command will change the name P-E to PME. The file GEN2AGCM-CONB-MONE0509.rename.nc will be identical to GEN2AGCM-CONB-MONE0509.nc except that P-E will be named PME.

Download the file: GEN2AGCM-CONB-SEAE0509.nc

Download the file metadata/header information (retrieved via ncdump -h): GEN2AGCM-CONB-SEAE0509.ncdump.txt

ncrename -v P-E,PME GEN2AGCM-CONB-MONE0509.nc GEN2AGCM-CONB-MONE0509.rename.nc

If you wanted to, you could write over the original file and not create a new file:
ncrename -v P-E,PME GEN2AGCM-CONB-MONE0509.nc

Ncrename can also be used to rename coordinate variables such as latitude and longitude. This is a little trickier because these latitude and longitude are both dimensions and variables within a file. Therefore, you have to rename both the dimension and and the variable.

EXAMPLE:

Rename latitude and longitude to lat and lon, respectively, using the same file as above, GEN2AGCM-CONB-SEAE0509.nc:
ncrename -d longitude,lon -d latitude,lat -v longitude,lon -v latitude,lat GEN2AGCM-CONB-MONE0509.nc GEN2AGCM-CONB-SEAE0509.rename2.nc

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: