Re: addfiles

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 17 2012 - 18:18:01 MDT

There are several issues.

===
[1]
When you do
f = addfiles(files,"r")
ListSetType(f,"join")

f is a variable of type 'list'
The syntax f[:] means the files are being aggregated and with
the 'join' you get
   [ncl_join | 9] x [nCells | 393218] x [nVertLevelsP1 | 42]

When f[iT] is used, you are accessing an individual file, you get
   [nCells | 393218] x [nVertLevelsP1 | 42]
There is no aggregate dimension.

[2] Try

z1 = new((/nFiles,nCells/),double)
z2 = new((/nFiles,nCells/),double)
rho1 = new((/nFiles,nCells/),double)
rho2 = new((/nFiles,nCells/),double)

; ++++++++++++++++++++++ zgrid ( nCells, nVertLevelsP1 )
; ++++++++++++++++++++++ rho ( Time, nCells, nVertLevels )

do iT = 0,8
  ;;z1(:) = 0.5*(f[iT]->zgrid(:,2)+f[iT]->zgrid(:,3))
    z1(iT,:) = 0.5*(f[iT]->zgrid(:,2)+f[iT]->zgrid(:,3))

  ;;z2(:) = 0.5*(f[iT]->zgrid(:,5)+f[iT]->zgrid(:,6))
    z2(iT,:) = 0.5*(f[iT]->zgrid(:,5)+f[iT]->zgrid(:,6))

    rho1(iT,:) = f[iT]->rho(0,:,2)
    rho2(iT,:) = f[iT]->rho(0,:,5)
  ;;rho2(iT,:) = f[iT]->rho(:,:,5) ; error !
end do

On 04/17/2012 04:15 PM, Laura Fowler wrote:
> Hi Dennis:
> I am processing the data on bluefire
> (/ptmp/laura/MPAS/physics/revision1721/atmos_physics/plots.mslp_mpas.ncl) with
> ncl 6.0.0. I added a few more printVarSummary and it seemed to work for
> iT=0, but crashed for iT=1. Thanks,
> Laura
>
>
> On 4/17/12 3:25 PM, Dennis Shea wrote:
>> Off line before I answer.... I'm going to a 3:30 seminar
>> so it won't be for awhile.
>>
>> ---
>>
>> These are not consistent:
>>
>> > z2(:) = 0.5*(f[iT]->zgrid(iT,:,5)+f[iT]->zgrid(iT,:,6))
>>
>> > z2 = 0.5*(f[:]->zgrid(:,:,5)+f[iT]->zgrid(:,:,6))
>> ^^
>>
>> Is this correct?
>>
>> ----
>>
>> Where are you processing the data?
>>
>> What versions of ncl and what system?
>>
>> %> ncl -V
>> %> uname -a
>>
>> On 4/17/12 3:05 PM, Laura Fowler wrote:
>>> 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
>>>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 17 18:18:12 2012

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