[ncl-talk] wrf_user_getvar "slp" (error)

Borja Sas González saszalez at gmail.com
Wed Sep 25 08:12:50 MDT 2019


I tried using the script in an out file with 1000 entries, it worked
without errors, so I understand that 9000 is a lot for me. Is there any way
to divide and get slp by parts?

El mié., 25 sept. 2019 a las 14:56, Dennis Shea (<shea at ucar.edu>) escribió:

> 9000 should be no problem ....
>
> slp(Time, south_north, west_east)
>
> say ....
>
>         Time = UNLIMITED ; // (9000 currently)
>         south_north = 96 ;
>         west_east = 111 ;
>
> is only
>
>        9000*96*111*4 ==> 383616000  bytes
>
> Even if several variables have to be used to derive 'slp', that should be
> no problem.
>
>
>
>
>
> On Wed, Sep 25, 2019 at 2:44 AM Borja Sas González <saszalez at gmail.com>
> wrote:
>
>> When telling me that it is a memory problem I have looked well at the out
>> file. There are 9000 entries that the file has. Can there be many to
>> calculate slp?
>>
>> El mié., 25 sept. 2019 a las 2:45, Dennis Shea (<shea at ucar.edu>)
>> escribió:
>>
>>> NCAR Command Language Version 6.6.2
>>>
>>>  The use of this software is governed by a License Agreement.
>>>
>>>  See http://www.ncl.ucar.edu/ for more details.
>>>
>>> fatal:NclMalloc Failed:[errno=12
>>>
>>> The above states that the error is a memory related issue:
>>>     f*atal:NclMalloc Failed:[errno=12]*
>>> --------------
>>> I do not have your d03 file but with 6.5.0 and 6.6.2:
>>> ========
>>> ncl 0> f = addfile("wrfout_d03_2007-12-29_00:00:00.two_time.nc","r")
>>> ncl 1> psfc = wrf_user_getvar(f,"slp",-1)
>>> ncl 2> printVarSummary(psfc)
>>>
>>> Variable: psfc
>>> Type: float
>>> Total Size: 85248 bytes
>>>             21312 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [*Time | 2] x [south_north | 96] x [west_east |
>>> 111]*
>>> Coordinates:
>>> Number Of Attributes: 6
>>>   description : *Sea Level Pressure*
>>>   units : hPa
>>>   coordinates : XLONG XLAT
>>>   stagger :
>>>   MemoryOrder : XYZ
>>>
>>> ---
>>> On Tue, Sep 24, 2019 at 12:26 PM Borja Sas González via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>> Hello everyone.
>>>>
>>>> When executing the scipt when I look for the slp variable through
>>>> wrf_user_getvar I get an error. I have tried with many more variables, and
>>>> everything works correctly, it is only with that one. The mistake is:
>>>>
>>>>  Copyright (C) 1995-2019 - All Rights Reserved
>>>>
>>>>  University Corporation for Atmospheric Research
>>>>
>>>>  NCAR Command Language Version 6.6.2
>>>>
>>>>  The use of this software is governed by a License Agreement.
>>>>
>>>>  See http://www.ncl.ucar.edu/ for more details.
>>>>
>>>> fatal:NclMalloc Failed:[errno=12]
>>>>
>>>> Violación de segmento
>>>>
>>>> El script es:
>>>>
>>>> begin
>>>>
>>>>
>>>> ; Abrir archivo
>>>>
>>>> files = systemfunc("ls
>>>> /home/ssd/chile/WRF/test/em_real/wrfout_d03_2017-12-31_00:00:00") + ".nc"
>>>>
>>>> a = addfiles(files,"r")
>>>>
>>>>
>>>> ; Definir latitud y longitud
>>>>
>>>> lat = -22.056923
>>>>
>>>> lon = -68.573862
>>>>
>>>>
>>>> ; Localización del punto más próximo
>>>>
>>>> opt = True
>>>>
>>>> loc = wrf_user_ll_to_xy(a,lon,lat,opt)
>>>>
>>>> loc2 = wrf_user_xy_to_ll(a,loc(0),loc(1),opt)
>>>>
>>>>
>>>>
>>>> lat2 = loc(1) ; Latitud para las variables
>>>>
>>>> lon2 = loc(0) ; Longitud para las variables
>>>>
>>>>
>>>>
>>>> ; Temperatura a 2m en ºC
>>>>
>>>> ;tk2 = wrf_user_getvar(a,"T2",-1)
>>>>
>>>> ;tk2 = tk2 - 273.15
>>>>
>>>> ;tk2 = decimalPlaces(tk2,2,True)
>>>>
>>>>
>>>> ; Viento a 10 m en m/s
>>>>
>>>> ;u10 =  wrf_user_getvar(a,"U10",-1)
>>>>
>>>> ;v10 =  wrf_user_getvar(a,"V10",-1)
>>>>
>>>> ;wspd = wind_speed(u10,v10)
>>>>
>>>> ;wspd = decimalPlaces(wspd,2,True)
>>>>
>>>>
>>>> ; Presión en superficie
>>>>
>>>> psfc = wrf_user_getvar(a,"slp",-1)
>>>>
>>>> psfc = decimalPlaces(psfc,2,True)
>>>>
>>>>
>>>> ; Humedad relativa a 2 m
>>>>
>>>> ;rh2 = wrf_user_getvar(a,"rh2",-1)
>>>>
>>>> ;rh2 = decimalPlaces(rh2,2,True)
>>>>
>>>>
>>>> ; Opciones del encabezado
>>>>
>>>> csv_filename = "data.csv"
>>>>
>>>> system("rm -f " + csv_filename)
>>>>
>>>> fields = (/"TIME, TEMPERATURE (ºC), PRESSURE (hPa), RH (%)"/)
>>>>
>>>>
>>>> ; Crear encabezado
>>>>
>>>> dq = str_get_dq()
>>>>
>>>> fields = dq + fields + dq
>>>>
>>>> header = [/str_join(fields,",")/]
>>>>
>>>>
>>>>
>>>> ; Formato de escritura de las variables
>>>>
>>>> ;format = "%s,%g,%g,%g;%g"
>>>>
>>>> format = "%s,%8.2f,%6.2f,%6.2f,%6.2f"
>>>>
>>>>
>>>> ; Crea el archivo con el encabezado
>>>>
>>>> write_table(csv_filename, "w", header, "%s")
>>>>
>>>>
>>>> ; Loop temporal
>>>>
>>>> times = wrf_user_getvar(a,"times",-1)
>>>>
>>>> ntimes = dimsizes(times)
>>>>
>>>> do it = 0,ntimes-1
>>>>
>>>>
>>>> ; Crea el archivo con las variables
>>>>
>>>> alist = [/times(it),psfc(it,lon2,lat2)/]
>>>>
>>>> write_table(csv_filename, "a", alist, format)
>>>>
>>>>
>>>> end do
>>>>
>>>>
>>>> end
>>>> --
>>>> Borja Sas González
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> --
>> Borja Sas González
>>
>

-- 
Borja Sas González
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190925/a4fc3452/attachment.html>


More information about the ncl-talk mailing list