<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi All<br>
<br>
I have currently worked out the regression and plotted a regression line for max precipitation in a certain domain and want to constrain the domain further. I am looking at a latlon box from 0-30S and 20-50E and would like to know how to constrain that further
by only choosing for example at 20E I only want to choose the max precip from 0-20S and at 50E from 10-30S.<br>
<br>
I am not quite sure how to code this type of thing and would appreciate if someone could point me to a similar example or provide some advice on how to go about this.<br>
<br>
Many thanks!<br>
<br>
Kind Regards<br>
Melissa<br>
<br>
;*************************************************************<br>
;Calculations of max precip for lat and lon values<br>
;**************************************************************<br>
<br>
dimpr2 = dimsizes(pr2) <br>
nlat = dimpr2(0) <br>
mlon = dimpr2(1) <br>
<br>
pr2MaxLon = new ( mlon, typeof(pr2), pr2@_FillValue)<br>
<br>
do ml=0,mlon-1<br>
imax = maxind(pr2(:,ml))<br>
pr2MaxLon(ml) = dble2flt(lat(imax)) <br>
end do <br>
<br>
print(pr2MaxLon)<br>
print(pr2&lon) <br>
<br>
print("-------------------------------") <br>
print("pr2MaxLon: "+pr2&lon+" "+pr2MaxLon) <br>
<br>
;Regression Line<br>
<br>
rcMaxLon = regline(pr2&lon,pr2MaxLon) <br>
print(rcMaxLon)<br>
<br>
print(rcMaxLon@yave) <br>
<br>
bMaxLon = rcMaxLon@yintercept<br>
print(bMaxLon) <br>
<br>
xMaxLon = pr2&lon<br>
print(xMaxLon) <br>
yMaxLon = rcMaxLon*pr2&lon + bMaxLon<br>
print(yMaxLon) <br>
<br>
print("-------------------------------") <br>
print(xMaxLon+" "+yMaxLon)<br>
<br>
<br>
;************************************************<br>
; create an array to hold both the original data<br>
; and the calculated regression line <br>
;************************************************<br>
<br>
data = new ( (/2,dimsizes(pr2MaxLon)/), typeof(pr2MaxLon))<br>
<br>
; y = mx+b <br>
; m is the slope: rc returned from regline<br>
; b is the y intercept: rc@yave attribute of rc returned from regline<br>
<br>
data(1,:) = dble2flt(rcMaxLon)*(dble2flt(xMaxLon)-dble2flt(rcMaxLon@xave)) + dble2flt(rcMaxLon@yave)<br>
;************************************************<br>
</div>
</body>
</html>