[ncl-talk] Array subsetting
Laura Fowler
laura at ucar.edu
Thu Oct 24 10:36:53 MDT 2019
Hello:
I have the following arrays:
Variable: diag
Type: float
Total Size: 1297613240 bytes
324403310 values
Number of Dimensions: 2
Dimensions and sizes: [nCells | 5898242] x [nVertLevels | 55]
Coordinates:
Number Of Attributes: 3
_FillValue : 9.96921e+36
long_name : Ice-friendly aerosol number concentration
units : nb kg^{-1}
Variable: k2
Type: integer
Total Size: 23592968 bytes
5898242 values
Number of Dimensions: 1
Dimensions and sizes: [nCells | 5898242]
Coordinates:
Number Of Attributes: 1
_FillValue : 0
where nCells is the horizontal dimension and nVertLevels is the number of
vertical levels. you can think of k2 as the index for the base of a
convective cloud with a missing value set to zero. I would like to build an
array nifa which contains the value of diag at k2, such that:
nifa(iCell) = diag(:,k2(iCell)) for iCell varying between 0 and nCells-1.
I tried to use the function "where" but this did not work. I get the
following:
nifa = where(k2.ne.k2 at _FillValue,diag(:,k2),diag at _FillValue)
fatal:NclMalloc Failed:[errno=12]
Segmentation fault (core dumped)
I am not sure why this is not working. I also tried the ismissing function
but this did not work either. Any suggestions?
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 at ucar.edu
phone: 303-497-1628
!-------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191024/1541de68/attachment.html>
More information about the ncl-talk
mailing list