Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
aerocom:faq-reformatting [2014-12-19 09:45:20] michaels |
aerocom:faq-reformatting [2022-05-31 09:29:31] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ATTENTION - THIS WIKI PAGE IS NO LONGER UPDATED - PLEASE GO TO [[http:// | ||
+ | |||
====== Reformatting files to AeroCom/ | ====== Reformatting files to AeroCom/ | ||
+ | |||
+ | **Note: these commands cover the elder phase 3 naming scheme, but should nevertheless still usefull** | ||
+ | |||
+ | The AeroCom standard is described in the section " | ||
+ | https:// | ||
+ | |||
+ | Below simple nco commands are listed which can be of help to reformat. | ||
+ | |||
+ | A public set of format correction tools is under development and can be accessed here:\\ | ||
+ | https:// | ||
===== How to remind me of nco commands ===== | ===== How to remind me of nco commands ===== | ||
Line 5: | Line 17: | ||
===== How to rename variables ===== | ===== How to rename variables ===== | ||
- | ncrename -v oldvar, | + | ncrename -v oldvar, |
===== How to add an attribute ===== | ===== How to add an attribute ===== | ||
- | ncatted -a experiment, | + | ncatted -a experiment, |
===== Split files per variable | ===== Split files per variable | ||
- | https://code.zmaw.de/ | + | cdo splitname in.nc |
+ | |||
+ | |||
+ | ===== rename dimension ===== | ||
+ | ncrename -O -d LATITUDE, | ||
+ | |||
+ | ===== sums ===== | ||
+ | ncap2 -O -s " | ||
+ | |||
+ | ===== compute vertical integrals ===== | ||
+ | rm dummy.nc | ||
+ | ncwa -O -v AERH2O3D_AER | ||
+ | ncrename -O -v AERH2O3D_AER, | ||
+ | ncks -F -A -v AERH2O_AER dummy.nc ${file} | ||
+ | |||
+ | ===== add variable to file ===== | ||
+ | ncks -F -A -v AIRE temp.nc ${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 | ||
+ | orgfile=MM_${model}.an${an}.mALLYEAR_an.nc | ||
+ | ncwa -F -O -a time ${file} ${orgfile} | ||
+ | |||
+ | ===== calculate yearly average ===== | ||
+ | fom 12 files each containing 1 month | ||
+ | ncra -F -O modis_2000?? | ||
+ | |||
+ | ===== 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 " | ||
+ | |||
+ | ===== Shift left and right hemispheres ===== | ||
+ | file1=aire_1.nc | ||
+ | ncks -h -F -O -d x,1,180 $file $file1 | ||
+ | file2=aire_2.nc | ||
+ | ncks -h -F -O -d x,181,360 $file $file2 | ||
+ | ncap -O -s " | ||
+ | |||
+ | 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 | ||
+ | |||
+ | file1=DD_${model}.an${AN}.mALLYEAR_1.nc | ||
+ | ncks -F -O -d x,1,180 $file $file1 | ||
+ | |||
+ | file2=DD_${model}.an${AN}.mALLYEAR_2.nc | ||
+ | ncks -F -O -d x,181,360 $file $file2 | ||
+ | ncap -O -s " | ||
+ | |||
+ | ncrcat -O $file2 $file1 $file | ||
+ | \rm $file1 $file2 | ||
+ | |||
+ | ncpdq -O -a time,y,x $file $file | ||
+ | |||
+ | ===== missing values ===== | ||
+ | ncatted -O -a missing_value, | ||
+ | ncatted -O -a missing_value, | ||
+ | |||
+ | actually better use attribute _FillValue (see http://nco.sourceforge.net) | ||
+ | |||
+ | |||
+ | ===== compute monthly mean files ===== | ||
+ | |||
+ | for IMTH in ${MTH[*]} ; do | ||
+ | file=DD_${model}.an${AN}.m${IMTH}.nc | ||
+ | filemean=DD_${model}.an${AN}.m${IMTH}_m.nc | ||
+ | ncra -F -O ${file} ${filemean} | ||
+ | done | ||
+ | |||
+ | |||
+ | ===== delete attributes ===== | ||
+ | ncatted -O -a ,,d,, interdummy.nc | ||
+ | ncatted -h -a ,global,d,, interdummy.nc | ||
+ | ncatted -h -a missing_value,, |