<div dir="ltr">; Details:<br>; I am extracting the dates from a netcdf file, when multiple conditions are met. I am using NCL 6.6.2.<br><br>; Conditions:<br>; 1. OLR < 240<br>; 2. uwnd < 0 <br>; 3. stretch_sph > 0<br><br><br> latS = 13.0<br> latN = 22.0<br> lonL = 120.0<br> lonR = 122.5<br><br> f = <b>addfile</b>("<a href="http://test_file_olr_wind_deform.nc">test_file_olr_wind_deform.nc</a>","r")<br> olr_region = <b>short2flt</b>(f->olr(:,{latS:latN},{lonL:lonR}))<br> u_region = f->uwnd(:,{latS:latN},{lonL:lonR})<br> stretch_region = f->stretch_sph(:,{latS:latN},{lonL:lonR})<br><br> <b>printVarSummary</b>(olr_region)<br> <b>printMinMax</b>(olr_region,0)<br> print("=====")<br><br> printVarSummary(u_region)<br> printMinMax( u_region,0)<br> print("=====")<br><br> printVarSummary(stretch_region)<br> printMinMax(stretch_region,0)<br> print("=====")<br><br> olr_threshold = 240<br> uwnd_threshold = 0<br> stretch_threshold = 0<br><br> olr_thres = <b>dim_min_n</b>(olr_region,(/1,2/)) ;min at each time step<br> uwnd_thres = <b>dim_min_n</b>( u_region,(/1,2/)) ;min at each time step<br> stretch_thres = <b>dim_max_n</b>(stretch_region,(/1,2/)) ;max at each time step<br><br> printVarSummary(olr_thres) ; [*] <br> print("=====")<br> printVarSummary(uwnd_thres)<br> print("=====")<br> printVarSummary(stretch_thres)<br> print("=====")<br><br> n_thres =<b> ind</b>((olr_thres .le. olr_threshold) .and. \<br> (uwnd_thres.le. uwnd_threshold) .and. \<br> (stretch_thres .ge. stretch_threshold))<br> print(n_thres)<br><div> print("=====")</div><div><br> TIME = u_region<b>&</b>time ; all times<br> YMD = <b>cd_calendar(</b>TIME,-2) ; all yyyy-mm-dd<br> ymd = YMD(n_thres) ; dates that satisfy criteria<br> print(ymd)</div><div><br></div><div> OLR = u_region(n_thres,:,:)<br> printVarSummary(OLR)<br>; or <br> u_region := u_region(n_thres,:,:)<br> printVarSummary(u_region)<br><br>; etc<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 26, 2019 at 11:13 PM Lyndz <<a href="mailto:olagueralyndonmark429@gmail.com">olagueralyndonmark429@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear NCL-experts,<div><br></div><div><b>Details:</b></div><div><div dir="ltr" class="gmail-m_1657659005907631258gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I am extracting the dates from a netcdf file, when multiple conditions are met. I am using NCL 6.6.2.</div><div dir="ltr"><br></div><div dir="ltr">The file that I am working with can be accessed from this link:</div><div dir="ltr"><a href="https://www.dropbox.com/s/cycpbdgxdzsdnbh/test_file_olr_wind_deform.nc?dl=0" target="_blank">https://www.dropbox.com/s/cycpbdgxdzsdnbh/test_file_olr_wind_deform.nc?dl=0</a><br></div><div dir="ltr"><br></div><div>This file contains 3 variables: OLR (short); uwnd(float); stretch_sph(float), with 123 timesteps.</div><div dir="ltr"><br></div><div>Attached is the script that I am using (date_filter.ncl).</div><div>Also attached is the time series of OLR for verification.</div><div><br></div><div><b>Conditions:</b></div><div>1. OLR < 240</div><div>2. uwnd < 0 </div><div>3. stretch_sph > 0</div><div><br></div><div><b>Problem/What I have so far:</b></div><div>I am filtering these variables using these lines:</div><div><br></div><div> <i>latS = 13.0<br> latN = 22.0<br> lonL = 120.0<br> lonR = 122.5<br></i></div><div><i><br></i></div><div dir="ltr"><i> olr_region=olr(:,{latS:latN},{lonL:lonR}) </i></div><div dir="ltr"><i> u_region=u(:,{latS:latN},{lonL:lonR})<br> stretch_region=stretch(:,{latS:latN},{lonL:lonR})</i></div><div dir="ltr"><br></div><div dir="ltr"><i> olr_threshold = 240<br> olr_thres = dim_min_n(olr_region,(/1,2/)) ;min at each time step<br><br> uwnd_threshold = 0<br> uwnd_thres = dim_min_n(u_region,(/1,2/)) ;min at each time step<br><br> stretch_threshold = 0<br> stretch_thres = dim_max_n(stretch_region,(/1,2/)) ;max at each time step<br><br> n_thres = ind((olr_thres .le. olr_threshold) .and. (uwnd_thres .le. uwnd_threshold) .and. </i></div><div dir="ltr"><i> (stretch_thres .ge. stretch_threshold))</i><br><div><br></div><div>When I print the dates, I am getting a value at <b>19810419</b>, but the time series shows that the OLR value at this period is above 240; hence, not satisfying condition 1. I would like to ask for help on how to implement this correctly in NCL.</div><div><br></div><div><b>Expected output:</b></div><div>Netcdf or csv file containing the dates that satisfied the 3 conditions.</div><div><br></div><div><br></div><div>I'll appreciate any suggestions. </div><div>--</div><div>Lyndz</div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>