Hi Dennis
To my surprise the example I gave does work without a loop but the results
are not what I expected... Here is the simple example and the results.
begin
inear = (/5,87,20,15/)
jnear = (/10,44,73,20/)
ff = addfile("/mnt/mimer/ahah/SBaltic/wrfout_d02_2010-10-30_00.nc","r")
u = new(dimsizes(inear),"float")
do k=0,dimsizes(inear)-1
u(k) = ff->U(0,0,inear(k),jnear(k))
end do
printVarSummary(u)
delete(u)
u = ff->U(0,0,inear,jnear)
printVarSummary(u)
end
The result for the first is a 1-D array, but a 2D array (4 x 4) from the
second!
Variable: u
Type: float
Total Size: 16 bytes
4 values
Number of Dimensions: 1
Dimensions and sizes: [4]
Coordinates:
Number Of Attributes: 7
coordinates : XLONG_U XLAT_U
stagger : X
units : m s-1
description : x-wind component
MemoryOrder : XYZ
FieldType : 104
_FillValue : 9.96921e+36
Variable: u
Type: float
Total Size: 64 bytes
16 values
Number of Dimensions: 2
Dimensions and sizes: [south_north | 4] x [west_east_stag | 4]
Coordinates:
Number Of Attributes: 6
FieldType : 104
MemoryOrder : XYZ
description : x-wind component
units : m s-1
stagger : X
coordinates : XLONG_U XLAT_U
---- Andrea N. Hahmann Senior Scientist Wind Energy Division Risų DTU Technical University of Denmark Risų National Laboratory for Sustainable Energy Frederikborgvej 399, P.O. Box 49 4000 Roskilde, Denmark Direct +45 4677 5471 Mobil: +45 2133 0550 ahah@risoe.dtu.dk http://www.risoe.dtu.dk On 10/20/11 7:31 PM, "Dennis Shea" <shea@ucar.edu> wrote: >I think the following will work: > > inear = (/5,87,20,15/) > jnear = (/10,44,73,20/) > u = ff->U(inear,jnear) > printVarSummary(u) > >On 10/20/11 7:19 AM, Hahmann, Andrea N. wrote: >> Good morning >> >> I have a not so small list of grid points I would like to read from a >>NetCDF file. Here is an example (ff is an open file): >> >> begin >> inear = (/5,87,20,15/) >> jnear = (/10,44,73,20/) >> >> u = new(dimsizes(inear),"float") >> do k=0,dimsizes(inear)-1 >> u(k) = ff->U(inear(k),jnear(k)) >> end do >> end >> >> Can this be rewritten without using the loop over the grid point? A >>similar loop seems to be slowing my script down and I have a lot of >>files to read >> >> Thanks, >> Andrea >> >> ---- >> Andrea N. Hahmann >> Senior Scientist >> Wind Energy Division >> Risų DTU >> >> Technical University of Denmark >> Risų National Laboratory for Sustainable Energy >> Frederikborgvej 399, P.O. Box 49 >> 4000 Roskilde, Denmark >> >> Direct +45 4677 5471 >> Mobil: +45 2133 0550 >> ahah@risoe.dtu.dk >> http://www.risoe.dtu.dk >> _______________________________________________ >> ncl-talk mailing list >> List instructions, subscriber options, unsubscribe: >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Fri Oct 21 09:51:08 2011
This archive was generated by hypermail 2.1.8 : Mon Oct 24 2011 - 09:29:35 MDT