[ncl-talk] sub: Memory allocation errror

David Brown dbrown at ucar.edu
Fri Feb 20 15:32:21 MST 2015


To begin with: addfiles_GetVar is deprecated and you do not need it.
The statement
  ta= f[:]->ta
does the same thing all over again. So just remove the line:
  ta    = addfiles_GetVar (f, fils, "ta")
Possibly (but not probably) that will fix your issue.

However, it would be good to know if the error occurred on that line or on the
   ta= f[:]->ta
line.  Which line is 14?

More generally you have given no indication of the size of the
variable you are trying to read.  How many files and how big is the
variable 'ta' in each file? Probably if you calculate the number of
bytes you are trying to read you will find that it would require more
memory than you have available in your machine. In that case you need
to figure out how to operate on subsets of the data in a loop. You
should first figure out how big a piece of data you can comfortably
work on at a time. You can subset the complete dataset by file or by
one or more of the dimensions in the variable. See the addfiles
documentation: http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml

Hope this helps.
 -dave


On Fri, Feb 20, 2015 at 2:33 PM, Adv <advita6 at gmail.com> wrote:
> Hi,
> I am trying to read netcdf files using addfiles. When i try to read variable
> it gives error. Could some one help me to fix this issue? Each file size
> 376M
>
> Thanks.
> My script:
> fils = systemfunc ("ls /pr/*.nc") ; file paths
> f    = addfiles (fils, "r")
> ta    = addfiles_GetVar (f, fils, "ta")
> ListSetType (f, "cat")
> ta= f[:]->ta                ; read T from all files
> printVarSummary (ta)
>
> The error:fatal:NhlRealloc Failed:[errno=12]
> fatal:Memory allocation failure:[errno=12]
> fatal:Execute: Error occurred at or near line 14 in file corrtemp.ncl
>
>
> Thank you
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list