简体   繁体   中英

chanaging standard_name and long_name with NCO

I calculated the potential temperaure from a NetCDF file. I would like to change standard_name and long_name with NCO . I have tried some commands without sucess, eg:

> ncatted -a name,Temperature,o,c,"Potential_Temperature" pt_19891020-19891022.nc

ncatted: ERROR File contains no variables or groups that match name Temperature so attribute name cannot be changed

> ncrename -a air_temperature,air_potential_temperature -a Temperature,Potential_Temperature pt_19891020-19891022.nc

ncrename: ERROR Required attribute 'air_temperature' not present in group '/'.
HINT: If attribute presence is intended to be optional, then prefix attribute name with the period character '.', e.g., .air_temperature. With this syntax ncrename would succeed even when no variables or groups contain the attribute. If the attribute is intended to be renamed only in a specific variable, then prepend the variable name plus an at-sign '@' to the attribute name, e.g., var_nm@att_nm. If attribute presence is required only for root group (i.e., a global attribute), then prefix attribute name with "global" and an at-sign, e.g., global@att_nm. If attribute presence is required for all groups, then prefix attribute name with "group" and an at-sign, e.g., group@att_nm.

Current file attributes:

$ cdo showattsvar pt_19891020-19891022.nc 
 pt:
   standard_name = "air_temperature"
   long_name = "Temperature"
   units = "K"
   missing_value = -32767

Desired attributes:

 pt:
   standard_name = "air_potential_temperature"
   long_name = "Potential_Temperature"
   units = "K"
   missing_value = -32767

These are attributes so ncatted is the correct tool, and the documentation is here with examples of the correct syntax:

ncatted -a standard_name,pt,o,c,air_potential_temperature -a long_name,pt,o,c,Potential_temperature pt_19891020-19891022.nc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM