Thursday, March 11, 2010

NCO example II ncap2

addpole.nco:
 defdim("new_y",$y.size+1);
 new_uas[$new_y,$x]=0.0f;
 new_y[$new_y]=0.0f;
 new_y(0:$y.size-1)=y;
 new_y($y.size)=90.0f;
 new_uas(0:$y.size-1,0:$x.size-1)=uas;
 *idx=0;
 *meanpole=0.0;
 while (idx<$x.size) {
   meanpole+=uas($new_y.size-2,idx);
   idx++;
 }
 meanpole=meanpole/idx;
 new_uas($new_y.size-1,0:$x.size-1)=meanpole;

ncap2 -v -S addpole.nco ori.nc modified.nc

1 comment:

Sasha said...

Hi

thanks for the very useful post. It would be also nice to see the result of ncdump -h on the input and output files.

Cheers

ShowCalendar