# [ncl-talk] Computing max of monthly NO2 data each year

Jack Ogaja jack.ogaja at gmail.com
Tue Sep 29 09:29:28 MDT 2015

```...
“The results I’ve obtained aren’t what I expected.”
...
Well, even Aristotle would struggle to figure out what you expected if you didn't tell him…

Your script still got visible mistakes though. For example the loop is quite extravagant:
…
k = ispan(0,11,1)
do n=0,7
do i = 0,275,12
do j=0,11
EUmax(n,:) = max(EU_plot(n,i+k(j))) <== “j” will always be the same type as, and equal to “k(j)”?
end do
end do
end do
…
and since the left side of your equation has a free dimension, the variable will always be overwritten up to the end of the loop.

You can clean the loop and do something like,
do n=0,7
yr=0
k =0
do i = 11,275,12
EUmax(n,k) = max(EU_plot(n,yr:i))
k=k+1
yr=i
end do
end do

I was also wondering whether from your file “EU(120:395,0)” will give you information from 2000 to 2012(12 years)? Probably that is the unexpected result you mentioned. Who knows?

I hope that helps.

Jack

> On 29 Sep 2015, at 15:02, Doumbia <thiernodoumbia at yahoo.fr> wrote:
>
> Dear ncl users,
>
> I am trying to compute the monthly maximum NO2 in a yearly basis.
>
> My input file contains 7 columns representing different variables and 396 lines (monthly mean NO2 data from 1980 to 2012). I am only interested by the 2000-2012 period .
>
> The results I’ve obtained aren’t what I expected.
> <max_of_monthly_data.ncl><Europe_bis_ncl.txt>
> I will appreciate any help to resolve this.
>
> Please find attached my script as well as my input file.
>