<div dir="ltr"><img class="mailtrack-img" alt="" style="display:flex" src="https://mailtrack.io/trace/mail/bc78ee63eefa5cfa405209aad9679137d47067e9.png?u=2827700" width="0" height="0"><div dir="ltr"><div dir="ltr"><div></div><div>I tried this but not working</div><div><br></div><div> arr = a->BCSMASS<br> lat = a->lat<br> lon = a->lon<br> <br> printVarSummary(arr)<br> timeT = cd_calendar(arr&time,-4) [==> <b><span style="color:rgb(255,0,0)">getting a warning</span></b>:cd_calendar: Unknown option, defaulting to 0.]<br> time = timeT(:,3)<br> <br> ;arr_min = dim_min( arr(lat|:, lon|:, time|:) ) <br> ;printVarSummary(arr_min)<br> ;printMinMax(arr_min,0)<br> <br> ;arr_max = dim_max( arr(lat|:, lon|:, time|:) ) <br> ;printVarSummary(arr_max)<br> ;printMinMax(arr_max,0)<br><br> ;time_min = arr_min ; arr_min contains the indices that were the minimum at each lat/lon point<br> ;time_max = arr_max<br> ;printVarSummary(time_max)<br> do gg = 0,dimsizes(arr_min&lat)-1<br> do hh = 0,dimsizes(arr_min&lon)-1<br> time_min(gg,hh) = time(arr_min(gg,hh))<br> time_max(gg,hh) = time(arr_max(gg,hh))<br> end do<br> end do<br></div><div><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br></div><div><font size="2"><span>Kunal Bali<br></span></font></div><br><div><b><br></b></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 1, 2018 at 3:05 AM Adam Phillips <<a href="mailto:asphilli@ucar.edu">asphilli@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Kunal,<div>Note that I recommended using dim_minind/dim_maxind, and not minind/maxind. Looking at the file you attached, you would pass your BCSMASS array into those two functions, and operate on the time (0) dimension. As previously stated, that will return a 2D array dimensioned lat x lon containing the desired indices. Then you would apply the double do loop coding I sent to form arrays of the times themselves. Again, the time array in my example coding needs to be set to something that is easily plotted, say the Hour. You can set up an hour array for your data like this:</div><div><div>a = addfile("<a href="http://hourmean.nc/" target="_blank">hourmean.nc</a>","r")</div><div>arr = a->BCSMASS</div><div>timeT = cd_calendar(arr&time,-4)</div><div>time = timeT(:,3)</div></div><div><br></div><div>Adam</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 12:02 PM Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thanks for this informations. </div><div><br></div><div dir="ltr">I tried to get min mad max by using the link which you mentioned, but the error comes with <span style="font-family:Menlo;font-size:16px">fatal:Argument type mismatch on argument (0) of (maxind) can not coerce</span></div><div dir="ltr"><br></div><div dir="ltr">I also tried the code given below but facing the same error here. (version-NCL 6.4.0) </div><div dir="ltr"><br><div><pre style="color:rgb(0,0,0);margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.333333015441895px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent">dims = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">dimsizes</strong></a>(X)
x1d = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">ndtooned</strong></a>(X) ; convert 2D array to 1D for use in maxind
inds = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">ind_resolve</strong></a>(<strong style="margin:0px;padding:0px">maxind</strong> (x1d), dims) ; convert 1D array back to 2D
ilat = inds(0,0) ; select the latitude index where the X array is at its' maximum
ilon = inds(0,1) ; select the longitude index where the X array is at its' maximum
lat_max = X&lat(ilat) ; insert the latitude index into the lat coordinate variable
lon_max = X&lon(ilon) ; insert the longitude index into the lon coordinate variable
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">print</strong></a>("Maximum value located at "+lat_max+", "+lon_max) </pre><pre style="color:rgb(0,0,0);margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.333333015441895px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><span style="color:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;font-size:small;white-space:normal">I also attached one sample file, in case if you need it. </span><br></pre><pre style="color:rgb(0,0,0);margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.333333015441895px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><br></pre><div><div dir="ltr" class="m_9043100172357683432m_-516362381720096746gmail_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"><div>---<br></div><div><font size="2"><span>Kunal Bali<br></span></font></div><div><br></div><div><b><br></b></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 2:47 AM Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Kunal,<div>If I understand correctly what you are after, you'd like to plot the time (at each grid point) where the maximum (or minimum) value occurs. </div><div>This will likely take some trial and error on your part. Here's what I think you need to do:</div><div>1) Use dim_minind and dim_maxind to isolate the index where the grid point value is at its min/max.</div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_maxind.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_maxind.shtml</a></div><div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_minind.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_minind.shtml</a></div><div><br></div><div>This will result in a 2-D array (dimensioned lat x lon) containing the minimum indices, and the same type of array containing the maximum indices.</div><div><br></div><div>2) There might be a more elegant way to map the indexes onto the correct times, but the following double do loop over the lat/lon dimensions will work:</div><div><br></div><div>; time is an array of your times</div><div>time_min = arr_min ; arr_min contains the indices that were the minimum at each lat/lon point</div><div>time_max = arr_max</div><div>do gg = 0,dimsizes(arr_min&lat)-1</div><div> do hh = 0,dimsizes(arr_min&lon)-1</div> time_min(gg,hh) = time(arr_min(gg,hh))</div><div> time_max(gg,hh) = time(arr_max(gg,hh))</div><div> end do</div><div>end do </div><div><br></div><div>You will want to make sure that your time array is in a format that is conducive to being plotted. (18:30 doesn't work for instance, but 1830 would.)</div><div>I think that's it. Try starting with the above suggestions and see if you can get things to work. If you have further questions about this subject please reply to the ncl-talk email list.</div><div>Adam</div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 6:57 AM Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><img class="m_9043100172357683432m_-516362381720096746m_-5177609042258427950m_7303927072719506909m_2850111241349097671mailtrack-img" alt="" style="display:flex" src="https://mailtrack.io/trace/mail/0f2b59e0335e8f788bf86f62901c8861f4700f5c.png?u=2827700" width="0" height="0"><div dir="ltr"><div></div><div>Dear NCL users,<br></div><div><br></div><div>I have one file (2000-2017) with time, latitude, longitude and variable. The time is given in hours(00:30 to 18:30). I need to plot a spatial map of hours values at each grid cells, the contour map of hours values should correspond to the variable values. So that I can see which hour has high and low-value on the map. Some examples are given for time vs latitude and time vs longitude, I don't need that. I need to plot time vs latitude longitude. <br></div><div><br></div><div>I hope you got my point.<br></div><div>Any information on that?</div><div><br></div><div>Thank You<br></div><div><div dir="ltr" class="m_9043100172357683432m_-516362381720096746m_-5177609042258427950m_7303927072719506909m_2850111241349097671gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br></div><div><font size="2"><span>Kunal Bali<br></span></font></div><br><div><b><br></b></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></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><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_9043100172357683432m_-516362381720096746m_-5177609042258427950m_7303927072719506909gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></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><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_9043100172357683432gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>