addfiles

From: Laura Fowler <laura_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 17 2012 - 15:05:58 MDT

Hi:
I have been trying to use addfiles to join several NetCDF files together
as follows:

files = (/ "x4.393218.output.2010-10-15_00:00:00.nc", \
            "x4.393218.output.2010-10-16_00:00:00.nc", \
            "x4.393218.output.2010-10-17_00:00:00.nc", \
            "x4.393218.output.2010-10-18_00:00:00.nc", \
            "x4.393218.output.2010-10-19_00:00:00.nc", \
            "x4.393218.output.2010-10-20_00:00:00.nc", \
            "x4.393218.output.2010-10-21_00:00:00.nc", \
            "x4.393218.output.2010-10-22_00:00:00.nc", \
            "x4.393218.output.2010-10-23_00:00:00.nc" /)
f = addfiles(files,"r")
ListSetType(f,"join")
f_dSizes = getfiledimsizes(f[0])
f_dNames = getvardims(f[0])
nTime = f_dSizes(2)
nCells = f_dSizes(3)
nLevels = f_dSizes(14)

I have two variables zgrid (independent of time) and rho (which is time
dependent). printVarSummary for zgrid and rho gives me the following
outputs:

Variable: zgrid (file variable)
Type: double
Total Size: 1189091232 bytes
             148636404 values
Number of Dimensions: 3
Dimensions and sizes: [ncl_join | 9] x [nCells | 393218] x
[nVertLevelsP1 | 42]
Coordinates:
Number Of Attributes: 0

Variable: rho (file variable)
Type: double
Total Size: 1160779536 bytes
             145097442 values
Number of Dimensions: 4
Dimensions and sizes: [ncl_join | 9] x [Time | 1] x [nCells | 393218]
x [nVertLevels | 41]
Coordinates:
Number Of Attributes: 0

Following what I got from printVarSummary, I wrote the following loop,
but ncl crashes with some fatal errors.

z1 = new((/nCells/),double)
z2 = new((/nCells/),double)
rho1 = new((/nCells/),double)
rho2 = new((/nCells/),double)
do iT = 0,8
    z1(:) = 0.5*(f[iT]->zgrid(iT,:,2)+f[iT]->zgrid(iT,:,3))
    z2(:) = 0.5*(f[iT]->zgrid(iT,:,5)+f[iT]->zgrid(iT,:,6))
    rho1(:) = f[iT]->rho(iT,:,:,2)
    rho2(:) = f[iT]->rho(iT,:,:,5)
end do

It does work if I do:
  z1 = 0.5*(f[:]->zgrid(:,:,2)+f[:]->zgrid(:,:,3))
  z2 = 0.5*(f[:]->zgrid(:,:,5)+f[iT]->zgrid(:,:,6))
  rho1 = f[:]->rho(:,:,:,2)
  rho2 = f[:]->rho(:,:,:,5)

I have two questions: 1) What's wrong in the loop above. I'd rather do a
loop to save memory; and 2) how to I grab the actual value for ncl_join
(do iT = 0,ncl_join-1 does not work).

Many thanks,
Laura

-- 
!----------------------------------------------------
  Laura D. Fowler
  Mesoscale and Microscale Meteorology Division (MMM)
  National Center for Atmospheric Research
  P.O. Box 3000, Boulder CO 80307-3000
  e-mail: laura@ucar.edu
  phone : 303-497-1628
!----------------------------------------------------
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 17 15:06:06 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 20 2012 - 16:21:18 MDT