'sdfopen ./04/20240426.nc'
'sdfopen ./04/20240427.nc'
'sdfopen ./04/20240428.nc'
'sdfopen ./04/20240429.nc'
'sdfopen ./04/20240430.nc'
'sdfopen ./05/20240501.nc'
'sdfopen ./05/20240502.nc'
'sdfopen ./05/20240503.nc'
'sdfopen ./05/20240504.nc'
'sdfopen ./05/20240505.nc'
'sdfopen ./05/20240506.nc'
'sdfopen ./05/20240507.nc'
'set lat -36 -24'
'set lon -58 -44'
'q dims'
linha=sublin(result,2)
xmin=subwrd(linha,11)
xmax=subwrd(linha,13)
linha=sublin(result,3)
ymin=subwrd(linha,11)
ymax=subwrd(linha,13)
*'set x 'xmin' 'xmax
*'set y 'ymin' 'ymax
'define ttprec=precipitation.1(t=1)+precipitation.2(t=1)+precipitation.3(t=1)+precipitation.4(t=1)+precipitation.5(t=1)+precipitation.6(t=1)+precipitation.7(t=1)+precipitation.8(t=1)+precipitation.9(t=1)+precipitation.10(t=1)+precipitation.11(t=1)'
'set display white'
'c'
'set mpdset brmap_hires'
'set clevs 50 100 150 200 250 300 350 400 450 500 550 600 650 700'
'd ttprec'
'run cbar.gs'
'q pos'
ycont=ymin
thr.1=0;thr.2=0;thr.3=0;thr.4=0;thr.5=0;thr.6=0;thr.7=0;thr.8=0;thr.9=0
thr.10=0;thr.11=0;thr.12=0;thr.13=0;thr.14=0;thr.15=0;thr.16=0;thr.17=0;thr.18=0;thr.19=0
thr.20=0;thr.21=0;thr.22=0;thr.23=0;thr.24=0;thr.25=0;thr.26=0;thr.27=0;thr.28=0;thr.29=0
thr.30=0;thr.31=0;thr.32=0;thr.33=0;thr.34=0;thr.35=0;thr.36=0;thr.37=0;thr.38=0;thr.39=0
thr.40=0;thr.41=0;thr.42=0;thr.43=0;thr.44=0;thr.45=0;thr.46=0;thr.47=0;thr.48=0;thr.49=0
thr.50=0;thr.51=0;thr.52=0;thr.53=0;thr.54=0;thr.55=0;thr.56=0;thr.57=0;thr.58=0;thr.59=0
thr.60=0
while (ycont <= ymax)
  'set  y 'ycont
  xcont=xmin
  while (xcont <= xmax)
    'set x 'xcont  
    'd ttprec'
    say result
    precval=subwrd(result,4)
    if (precval>=10) & (precval<50);thr.1=thr.1+1 ; endif
    if (precval>=50) & (precval<100);thr.2=thr.2+1 ; endif
    if (precval>=100) & (precval<150);thr.3=thr.3+1 ; endif
    if (precval>=150) & (precval<200);thr.4=thr.4+1 ; endif
    if (precval>=200) & (precval<250);thr.5=thr.5+1 ; endif
    if (precval>=250) & (precval<300);thr.6=thr.6+1 ; endif
    if (precval>=300) & (precval<350);thr.7=thr.7+1 ; endif
    if (precval>=350) & (precval<400);thr.8=thr.8+1 ; endif
    if (precval>=400) & (precval<450);thr.9=thr.9+1 ; endif
    if (precval>=500) & (precval<550);thr.10=thr.10+1 ; endif
    if (precval>=550) & (precval<600);thr.11=thr.11+1 ; endif
    if (precval>=650) & (precval<700);thr.12=thr.12+1 ; endif
    if (precval>=700) & (precval<750);thr.13=thr.13+1 ; endif
    if (precval>=800);thr.14=thr.14+1 ; endif
    xcont = xcont + 1
  endwhile
  ycont = ycont + 1
endwhile
i=1
while (i<=14)
  say thr.i
  i = i+1
endwhile
