[ncl-talk] EOF analysis
Dennis Shea
shea at ucar.edu
Mon Apr 27 06:40:22 MDT 2015
1] Like Alessandra wrote .... "a memory issue".
fatal:NclMalloc Failed <=== memory allocation error
[2] Like Wei wrote, the following will likely solve your problem
try change line:
cru = f->pre(iYYYY,:,:)
to:
cru = f->pre(iYYYY,{lat|latS:latN},{lon|lonE:lonE})
*** BUT THERE IS MORE TO IT THAN THIS ****
[3] Examine what you are doing:
yrStrt = 1958
yrLast = 2008
:
iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
:
cru = f->pre(iYYYY,:,:)
printVarSummary(cru) ; variable overview
Look at the output from 'printVarSummary'
Based on the 'print(f)', there are 51(years)*12(months)= 612 time steps
(iYYYY)
double pre ( time, lat, lon ) ; (612,360,720)
Since type 'double (8 bytes) ====> 8*612*360*720= 1,269,043,200 is
approximately 1.3 GB
===========
According to your code, you only want the region
latS = -13.
latN = 16.
lonE = 21. <=== this is wrong .. should be lonW = 21.
lonE = 53.
so **why** are you reading in the **whole** array???
Also, why are you doing the following .... It is **not** needed. It uses
another 1.3GB
because a copy of the array is made.
cru = lonFlip( cru )
printVarSummary(cru) ; note the longitude
coord
The data span -180 to 180 ... lonW=21 to lonE=53 are readily available.
***
The point of this is that
USERS SHOULD NOT DIRECTLY USE THE PROVIDED EXAMPLES.
They are provided as templates and are not 'plug and use'.
***
======== My *guess* is that you want something like the following
... PLEASE look at all of the output
cru = f->pre(iYYYY,{latS;latN},{lonW:lonE})
printVarSummary(cru) ; variable overview
; ==============================================================
; compute desired global seasonal mean: month_to_season (contributed.ncl)
; ==============================================================
SLP = month_to_season (cru, season)
nyrs = dimsizes(SLP&time)
printVarSummary(SLP)
; =================================================================
; create weights: sqrt(cos(lat)) [or sqrt(gw) ]
; =================================================================
rad = 4.*atan(1.)/180.
clat = SLP&lat ; use 'lat' associated
with data
clat = sqrt( cos(rad*clat) ) ; gw for gaussian grid
; =================================================================
; weight all observations
; =================================================================
wSLP = SLP ; copy meta data
wSLP = SLP*conform(SLP, clat, 1)
wSLP at long_name = "Wgt: "+wSLP at long_name
; =================================================================
; Reorder (lat,lon,time) the *weighted* input data
; Access the area of interest via coordinate subscripting
; =================================================================
x = wSLP(lat|:,lon|:,time|:)
:
[4] Please read the NCL documentation
http://www.ncl.ucar.edu/Document/Manuals/language_man.pdf
or, a very nice tutorial created by DKRZ
https://dl.dropboxusercontent.com/u/8357888/homepage/tutoriais/ncl/NCL_Tutorial_V1.1.pdf
https://dl.dropboxusercontent.com/u/8357888/homepage/tutoriais/ncl/NCL_Exercises_and_Tasks_all.pdf
On Sun, Apr 26, 2015 at 9:16 PM, Wei Huang <huangwei at ucar.edu> wrote:
> Nana,
>
> Try change line:
> cru = f->pre(iYYYY,:,:)
> to:
> cru = f->pre(iYYYY,{lat|latS:latN},{lon|lonE:lonE})
>
> Which may solve your memory problem.
>
> Good luck.
>
> Wei
>
> ================================================
> 1850 Table Mesa Dr.
> Boulder, CO 80307
> Phone: 303-497-8924
>
> On Sat, Apr 25, 2015 at 2:55 PM, Alessandra Giannini <
> alesall at iri.columbia.edu> wrote:
>
>>
>> Hello Nana,
>>
>> it looks like this could be generically a memory issue - your computer
>> has a hard time managing all the data it is ingesting.
>>
>> As boring as this will sound, my suggestion is that you execute your
>> script line by line, to see where it fails.
>> By this I mean starting NCL and copying and pasting into the NCL
>> environment line by line…
>>
>> warm regards, ale
>>
>>
>>
>>
>>
>>
>> --
>> Alessandra Giannini
>> IRI for Climate and Society - The Earth Institute at Columbia University
>> P.O. Box 1000, Palisades NY 10964-8000
>> phone/fax: +1 845 680-4473/4864 - email: alesall at iri.columbia.edu
>>
>> On Apr 25, 2015, at 1:41 PM, Nana kofi Appiah-badu <justappia at gmail.com>
>> wrote:
>>
>> > Hello everyone,
>> >
>> > I downloaded the eof script and using it to perform an eof analysis to
>> obtain the first three eofs and their corresponding time series from the
>> cru data from 1958 to 2008 during the MAM (MARCH, APRIL, MAY ) season. but
>> this error message pops up after i start to run the script:
>> >
>> > fatal:NclMalloc Failed:[errno=12]
>> > Segmentation fault (core dumped)
>> >
>> > below is the full output when i run the script.
>> >
>> > Variable: f
>> > Type: file
>> > filename: cru
>> > path: cru.nc
>> > file global attributes:
>> > Conventions : CF-1.4
>> > title : CRU TS3.21 Precipitation
>> > institution : Data held at British Atmospheric Data Centre, RAL,
>> UK.
>> > source : Run ID = 1307101324
>> > Data generated by BADC from:
>> > pre.1307101049.dtb
>> > history : Wed 10 Jul 2013 18:28:10 BST : User ianharris : Program
>> makegridsauto.for called by update.for
>> > references : Information on the data is available at
>> http://badc.nerc.ac.uk/data/cru/
>> > comment : Data restrictions: for academic research use
>> only.Contact BADC for details
>> > contact : BADC <badc at rl.ac.uk>
>> > dimensions:
>> > lon = 720
>> > lat = 360
>> > time = 1344 // unlimited
>> > variables:
>> > double lon ( lon )
>> > long_name : longitude
>> > units : degrees_east
>> >
>> > double lat ( lat )
>> > long_name : latitude
>> > units : degrees_north
>> >
>> > double time ( time )
>> > long_name : time
>> > units : days since 1900-1-1
>> > calendar : gregorian
>> >
>> > double pre ( time, lat, lon )
>> > long_name : precipitation
>> > units : mm
>> > correlation_decay_distance : 450
>> > _FillValue : 9.969209968386869e+36
>> > missing_value : 9.969209968386869e+36
>> >
>> >
>> > Variable: cru
>> > Type: double
>> > Total Size: 1269043200 bytes
>> > 158630400 values
>> > Number of Dimensions: 3
>> > Dimensions and sizes: [time | 612] x [lat | 360] x [lon | 720]
>> > Coordinates:
>> > time: [21199..39796]
>> > lat: [-89.75..89.75]
>> > lon: [-179.75..179.75]
>> > Number Of Attributes: 5
>> > long_name : precipitation
>> > units : mm
>> > correlation_decay_distance : 450
>> > _FillValue : 9.969209968386869e+36
>> > missing_value : 9.969209968386869e+36
>> > fatal:NclMalloc Failed:[errno=12]
>> > Segmentation fault (core dumped
>> >
>> > i have attached the script and the error after starting to run.
>> >
>> > Thank you for your time and assistance.
>> >
>> > Regards,
>> >
>> > Nana.
>> > <eof_1.ncl><error
>> message.odt>_______________________________________________
>> > 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-talk
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150427/82c2934d/attachment.html
More information about the ncl-talk
mailing list