[ncl-talk] Calculate Average value for a number of files
Jack Ogaja
jack.ogaja at gmail.com
Thu Nov 19 11:38:04 MST 2015
Sorry. Change the following lines;
;===
dust_tot=(/dustJ1,dustJ2,dustJ3,dustJ4,dustJ5/)
to
dust_tot=dim_sum_n((/dustJ1,dustJ2,dustJ3,dustJ4,dustJ5/),0)
and
dustnew = dim_avg_n(dust_tot, (/0,1,2/))
to
dustnew = dim_avg_n(dust_tot, (/0,1/))
;===
Jack
> On 19 Nov 2015, at 19:04, Jack Ogaja <jack.ogaja at gmail.com> wrote:
>
> Dear Ioannis,
>
> I think sometimes it is better if you just show the error message instead of asking people to download the data. For example your script simply generates the following error;
> ;=====
> fatal:Number of subscripts do not match number of dimensions of variable,(2) Subscripts used, (1) Subscripts expected
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 77 in file readwrite_dust_all_2.ncl
> ;=====
> which should be a clear message and indicating where the error occurs.
>
> Anyway, since you are only interested in the numbers, I think you would understandably do away with the outer loop and try something like;
>
> ;=====
> aJ = addfile(FILES(0)+".nc","r")
> bJ = addfile(FILES(1)+".nc","r")
> …
> dustJ1 = (/wrf_user_getvar(aJ,"DUST_1",it), wrf_user_getvar(bJ,"DUST_1",it)/)
> .
> .
> .
> dustJ5 = …
>
> dustnew = dim_avg_n(dust_tot, (/0,1,2/))
> .
> .
> .
> ;=====
>
> See the attached script with such lines(modified from your original script).
>
> Jack
>
> <readwrite_dust_all_2_Jack20151119.ncl>
>
>> On 19 Nov 2015, at 16:04, Ioannis Koletsis <koletsis at meteo.noa.gr <mailto:koletsis at meteo.noa.gr>> wrote:
>>
>> Dear all,
>> I would like to write down the average value of a variable for each lat, lon point from a number of wrfoutput files….
>>
>> The input files are the wrfoutput files which you can find here
>> (https://www.dropbox.com/s/kgogk9jcn0m65e8/wrfout_d01_2015-09-12_12%253A00%253A00?dl=0 <https://www.dropbox.com/s/kgogk9jcn0m65e8/wrfout_d01_2015-09-12_12%253A00%253A00?dl=0> , https://www.dropbox.com/s/u8d0wkr2i2u7ydc/wrfout_d01_2015-09-12_15%253A00%253A00?dl=0 <https://www.dropbox.com/s/u8d0wkr2i2u7ydc/wrfout_d01_2015-09-12_15%253A00%253A00?dl=0> )
>> and the variable that I want to calculate the average value from the input files is the dust_tot…
>>
>> Have you got any idea what is going wrong with my script?
>> Any help would be appreciated …
>>
>> Best Regards
>>
>> Ioannis
>>
>>
>>
>>
>>
>>
>> Dr. Ioannis Koletsis
>> National Observatory of Athens
>> Institute for Environmental Research
>> Lofos Koufou
>> 15236-Penteli
>> Athens-Greece
>> Tel: +30 2108109134
>> e-mail: koletsis at meteo.noa.gr <mailto:koletsis at meteo.noa.gr>
>> ----------------------------------------------------------------------------------------
>> Weather forecasts: http://www.noa.gr/forecast <http://www.noa.gr/forecast> (in english)
>> or http://www.meteo.gr <http://www.meteo.gr/> (in greek)
>> Weather forecasts for Europe: http://www.eurometeo.gr <http://www.eurometeo.gr/> (in english)
>> ----------------------------------------------------------------------------------------
>>
>>
>>
>> <https://www.avast.com/antivirus>
>> Αυτό το e-mail ελέγχθηκε για ιούς από το πρόγραμμα Avast antivirus.
>> www.avast.com <https://www.avast.com/antivirus>
> <readwrite_dust_all_2.ncl>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151119/3e11a9bb/attachment.html
More information about the ncl-talk
mailing list