<div dir="ltr"><div>Sorry if what I wrote was not clear.</div><div><br></div><div>A sketch of a script follows.</div><div>===========================<br></div><div> dirHWRF = "..."<br> filHWRF = "..."<br> pthHWRF = dirHWRF + filHWRF<br> nfil = <b>dimsizes</b>(filHWRF)<br><br>; Trick to have NCL do book-keeping of 'time'.</div><div>; Have NCL's addfiles create a 'time' array that spans all times<br>; It is assumed that there is one time step per file <br>;;setfileoption("grb","SingleElementDimensions",(/"Initial_time", "Forecast_time"/)) <br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml"><b>setfileoption</b></a>("grb","SingleElementDimensions", "Initial_time") <br><br> fadd = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml"><b>addfiles</b></a>(pthHWRF,"r")<br> time = fadd<b>[:]</b>->initial_time0_hours ; times acriss all files<br> time!0 = "time"<br> ntim = <b>dimsizes</b>(time)<br> ymdh = c<b>d_calendar</b>(time,-3)<br> ymdh!0 = "time"<br> print(time+" "+ymdh)<br> print("------------")<br> <br> if (ntim.ne.nfil) then<br> print("nim="+ntim+" : nfil="+nfil: should be equal)<br> exit<br> end if<br><br> plev = <b>ff[0]</b>->lv_ISBL0 ; get from 1st file [invariant]<br> plev!0 = "plev"</div><div> print(plev)<br></div><div> delete(fadd)<br><br>;---Sonde locations<br><br> SLAT = (/lat1, lat2, lat3/) ; one or more Sonde lat<br> SLON = (/lon1, lon2, lon3/)<br> npts = dimsizes(SLAT)<br><br> xsonde = new((/ntim,klev,npts/),"float", -1e10) ; allocate space for variable</div><div>;;ysonde = new((/ntim,klev,npts/),"float", -1e10) <br></div><div>;;zsonde = new((/ntim,klev,npts/),"float", -1e10) <br></div><div><br></div><div> do nf=0,nfil-1 <span style="color:rgb(0,0,255)">one time step per file; lat_0, lon_0 coordinates may change</span><br> f = <b>addfile</b>(pthHWRF<b>(nf)</b>,"r")<br> x = f->X ; X( initial_time0_hours0, lv_ISBL0, lat_0, lon_0 )<br> xsonde(nf,:,:)) = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml"><b>linint2_points_Wrap</b></a>(x&lon_0, x&lat_0, x, False,SLAT,SLON 0)<br> end do <br></div><div><br></div><div> xsonde!0 = "time"<br> xsonde&time = time<br> xsonde!1 = "plev"<br> xsonde&plev = plev<br> xsonde!2 = "sonde"<br><br> <b>printVarSummary</b>(xsonde)</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 3, 2019 at 3:51 PM Andrew Kren - NOAA Affiliate <<a href="mailto:andrew.kren@noaa.gov">andrew.kren@noaa.gov</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">So what you are saying is that I should interpolate to the location first. Then after I do that, I can interpolate multiple locations to the time? This is how I understand it given the limitation.<div><br></div><div>Thanks,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 3, 2019 at 2:59 PM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</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"><div>I assume you are processing multiple GRIB2 files using <b>addfiles.</b></div><div>This is appropriate<b> </b>if the same grid is applicable to all files. <br></div><div><b>addfiles </b>will concatenate all the file times. You only need to use one grid.<br></div><div>--- <br></div><div>In the case of the HWRF grids (possibly) changing at each time step, you will have to step through the files manually. This means you will have to do some book-keeping.<br></div><div><br></div><div> dirHWRF = "..."</div><div> filHWRF = "..."</div><div> pthHWRF = dirHWRF + filHWRF</div><div> nfil = dimsizes(filHWRF)</div><div><br></div><div> SLAT = ; one or more Sonde lat</div><div> SLON =<br></div><div><br></div><div> do nf=0,nfil-1</div><div> f = addfile(pthHWRF(nf),"r")</div><div> x = f->X</div><div> xsonde(nf.....) = <strong>linint2_points</strong>(x&lon_0, x&lat_0, False,SLAT,SLON 0)</div><div><br></div><div> end do</div><div><br></div><div>Good Luck<br></div><div><b></b></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 3, 2019 at 1:19 PM Andrew Kren - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</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-talk,<div><br></div><div>I am working to interpolate a high-resolution model dataset (HWRF) to the time and location of a dropsonde location. In the past for other datasets, I have used linint1_n and linint2_points to interpolate in time and space to the dropsonde position.</div><div><br></div><div>However, HWRF, which is 6-hour analysis output, has a varying grid every 6 hours as the domain "moves" with the tropical cyclone. Hence, the lat/lon locations are not fixed in time. They have the same dimension sizes but the points vary depending on the cyclone center. This led to an error in my linint2_poi<font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000">nts function:</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000"><br></font></div><div>
<p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">fatal:linint2_points: If xi is not one-dimensional, then it must have one less dimension than fi</font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">I know why this is happening. I read in two HWRF files around the dropsonde time to do the interpolation. I used "join" to join the files and my lat/lon arrays are (time, lat) and (time, lon). So I get the error. </font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">But my question is how best to proceed? This is technically not an unstructured grid, but could be considered one. Should I use ESMF?</font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail-s1" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">Thanks,</font></span></p><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000"><br></font></div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000">-- <br></font><div dir="ltr" class="gmail-m_242400818736914268gmail-m_2613159989541022089gmail-m_2763483926837424257gmail_signature"><div dir="ltr"><div><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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000">Andrew Kren<br>Assistant Scientist</font><br>University of Miami CIMAS - NOAA/AOML</div><div dir="ltr"><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#000000">Global Observing Systems Analysis (GOSA) Group</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#000000">NOAA/AOML Quantitative Observing System Assessment Program (QOSAP)</font></div></div></div></div></div></div></div></div></div></div></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></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_242400818736914268gmail_signature"><div dir="ltr"><div><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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Andrew Kren<br>Assistant Scientist<br>University of Miami CIMAS - NOAA/AOML</div><div dir="ltr"><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#000000">Global Observing Systems Analysis (GOSA) Group</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#000000">NOAA/AOML Quantitative Observing System Assessment Program (QOSAP)</font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>