#!/usr//bin/ksh
typeset -u v1

pp=/scratch/local1/sat_cloud_aer_rad/AEROCOM_IND/PNNL/
nn=cam3_6_15_mod7_aerocomAIE.cam2.h0.0004.nc
mm=pnnl

for v in albs ccn cdnc cdr lwp od550 lcc tcc rlt rst rstcs ttop ;do
v1=${v}_OP
cdo selvar,$v1 $pp/$nn 1.nc
ncrename -v${v1},${v} 1.nc
cdo remapbil,mygrid 1.nc ../data/${v}_$mm.nc
done

cdo selvar,RST_OP $pp/$nn 1.nc
ncrename -vRST_OP,albscs 1.nc
cdo selvar,ALBS_OP $pp/$nn 2.nc
ncrename -vALBS_OP,albscs 2.nc
cdo mulc,-1. 2.nc 3.nc
cdo addc,1. 3.nc 2.nc
cdo div 1.nc 2.nc 3.nc
cdo selvar,RSTCS_OP $pp/$nn 1.nc
ncrename -vRSTCS_OP,albscs 1.nc
cdo div 1.nc 3.nc 2.nc
cdo mulc,-1. 2.nc 1.nc
cdo addc,1. 1.nc 2.nc
cdo remapbil,mygrid 2.nc ../data/albscs_$mm.nc

