User Tools

Site Tools


Reformatting files to AeroCom/HTAP standards

How to remind me of nco commands

Just type the command without arguments on a command line

How to rename variables

 ncrename -v oldvar,newvar

How to add an attribute

 ncatted -a experiment,newvar,a,c,"BASE"

Split files per variable

rename dimension

 ncrename -O -d LATITUDE,y       


 ncap2 -O -s "LOAD_BCPOM[time,x,y]=LOAD_BC+LOAD_POM" ${file} ${file} 

compute vertical integrals

 ncwa -O -v AERH2O3D_AER   -a z -y ttl     ${file}  
 ncrename -O -v AERH2O3D_AER,AERH2O_AER 
 ncks -F -A -v AERH2O_AER ${file} 

add variable to file

 ncks -F -A -v AIRE ${file}

make the time dimension unlimited

 ncecat -O $file $file
 ncpdq -O -a time,record $file $file
 ncwa -O -a record $file $file
 ncpdq -O -a time,y,x $file $file

turn z

 ncpdq -O -a -z $file $file

create yearly mean file

from 12 months in one file

 ncwa -F -O -a time ${file} ${orgfile}

calculate yearly average

fom 12 files each containing 1 month

 ncra -F -O  modis_2000??.nc ${yearfile}

create record dimension

 ncecat -O $file $file 

delete useless record dimension

 ncwa -O -a record $file $file 

turn lat to have right order

with interpolated files

 ncpdq -O -a "-y" $file $file 

Shift left and right hemispheres
 ncks -h -F -O -d x,1,180 $file $file1
 ncks -h -F -O -d x,181,360 $file $file2
 ncap -O -s "x[x]=x-360" $file2 $file2
 ncrcat -O $file2 $file1 $file
\rm  $file1 $file2

Similar reorder of longitude

ncecat -O $file $file 
ncpdq -O -a x,record $file $file 
ncwa -O -a record $file $file 
ncks -F -O -d x,1,180 $file $file1
ncks -F -O -d x,181,360 $file $file2
ncap -O -s "x[x]=x-360" $file2 $file2

ncrcat -O $file2 $file1 $file
\rm  $file1 $file2	
ncpdq -O -a time,y,x $file $file 

missing values

ncatted -O -a missing_value,$var,o,f,0 ${file} 
ncatted -O -a missing_value,$var,o,f,-9999 ${file} 

actually better use attribute _FillValue (see

compute monthly mean files

  for IMTH in ${MTH[*]} ; do 
ncra -F -O  ${file} ${filemean}

delete attributes

  ncatted -O -a ,,d,,
  ncatted -h -a ,global,d,,
  ncatted -h -a missing_value,,d,,
aerocom/faq-reformatting.txt · Last modified: 2014-12-19 12:16:53 by michaels