<div dir="ltr"><div><div>Apologies: I was in too much of a rush.<br><br></div>The following uses the files you sent.<br>======================<br><br>; vector of names of all of the files and add full file path<br> <br>diri = "./"<br>fili = systemfunc("ls "+diri+"NLDAS_FORA0125_H.A2009*.002.grb")<br>print(fili) ; make sure the desired files are listed in the correct order<br><br>; read in all files<br><br>;ListSetType (grb_file, "join") <br>setfileoption("grb","SingleElementDimensions","Initial_time") ; initial_time0_hours<br><br>grb_file = addfiles(fili,"r")<br>data = grb_file[:]->DSWRF_110_SFC<br>data!0 = "time"<br>printVarSummary(data)<br><br>;====<br> LAT = (/ 48.5625/) ; read from text file<br> LON = (/-98.9375/)<br> LAT@units = "degrees_north"<br> LON@units = "degrees_east"<br><br>; Simple approx:<br><br> print(data(:,{LAT},{LON}) )<br>;=====<br>; or better use:<br><br>;<a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml</a><br><br>points = linint2_points(data&lon_110,data&lat_110,data, False, LON,LAT, 0)<br>printVarSummary(points)<br>print("--------------")<br><br>+++++++++++++++++++++++++++++<br>Variable: fili<br>Type: string<br>Total Size: 24 bytes<br> 3 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [3]<br>Coordinates: <br>(0) ./NLDAS_FORA0125_H.A20090316.0100.002.grb<br>(1) ./NLDAS_FORA0125_H.A20090316.0200.002.grb<br>(2) ./NLDAS_FORA0125_H.A20090316.0300.002.grb<br><br>Variable: data<br>Type: float<br>Total Size: 1247232 bytes<br> 311808 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 3] x [lat_110 | 224] x [lon_110 | 464]<br>Coordinates: <br> time: [1833841..1833843]<br> lat_110: [25.063..52.938]<br> lon_110: [-124.938..-67.063]<br>Number Of Attributes: 12<br> sub_center : NESDIS Office of Research and Applications<br> center : US National Weather Service - NCEP (WMC)<br> long_name : Downward shortwave radiation flux<br> units : W/m^2<br> _FillValue : 1e+20<br> level_indicator : 1<br> gds_grid_type : 0<br> parameter_table_version : 130<br> parameter_number : 204<br> model : MESO NAM Model (currently 12 km)<br> forecast_time : 0<br> forecast_time_units : hours<br>------<br>Variable: data (subsection) <==== print(data(:,{LAT},{LON}) )<br>Type: float<br>Total Size: 12 bytes<br> 3 values<br>Number of Dimensions: 1<br>Dimensions and sizes: <b>[time | 3]</b><br>Coordinates: <br> time: [1833841..1833843]<br>Number Of Attributes: 14<br> lon_110 : -98.938<br> lat_110 : 48.563<br> forecast_time_units : hours<br> forecast_time : 0<br> model : MESO NAM Model (currently 12 km)<br> parameter_number : 204<br> parameter_table_version : 130<br> gds_grid_type : 0<br> level_indicator : 1<br> _FillValue : 1e+20<br> units : W/m^2<br> long_name : Downward shortwave radiation flux<br> center : US National Weather Service - NCEP (WMC)<br> sub_center : NESDIS Office of Research and Applications<br>==========<br><br></div>Variable: points<br>Type: float<br>Total Size: 12 bytes<br> 3 values<br>Number of Dimensions: 2<br>Dimensions and sizes: <b>[time | 3] x [pts | 1]</b><br>Coordinates: <br> time: [1833841..1833843]<br> pts: [0..0]<br>Number Of Attributes: 14<br> _FillValue : 1e+20<br> sub_center : NESDIS Office of Research and Applications<br> center : US National Weather Service - NCEP (WMC)<br> long_name : Downward shortwave radiation flux<br> units : W/m^2<br> level_indicator : 1<br> gds_grid_type : 0<br> parameter_table_version : 130<br> parameter_number : 204<br> model : MESO NAM Model (currently 12 km)<br> forecast_time : 0<br> forecast_time_units : hours<br> xcoord : -98.9375<br> ycoord : 48.5625<br><br><div><br><br><br><br><br><br><div><div><div><div><br><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 9, 2018 at 1:59 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><p class="MsoNormal">[1]</p><p class="MsoNormal">The following is incorrect. grb_list is a one-dimensional *array* of file names containing strings (text). You have it as a single string.<br></p><span class=""><p class="MsoNormal"><br></p><p class="MsoNormal"> grb_file = addfiles("grb_list","r") <br></p><p class="MsoNormal"><br></p></span><p class="MsoNormal">Use <br></p><p class="MsoNormal"><br></p><p class="MsoNormal"> grb_file = addfiles( grb_list ,"r") ; pass the 1-d array of file names<br></p>=============<br>[2]<br></div>You want time series, N'est ce pas? Remove the following:<br><br> ListSetType (grb_file, "join") ; NO: NOT if you want a time serie<br>=============<br>[3]<br><br><div><span class=""><br>diri = ncargpath("/depot/phig/apps/LI<wbr>S_VIC/NLDAS_Forcing/discover/<wbr>nobackup/projects/lis/MET_<wbr>FORCING/NLDAS2.FORCING/2009/<wbr>075/")</span><p class="MsoNormal">grb_file = addfiles("grb_list","r")</p><p class="MsoNormal">data = grb_file[:]->DSWRF_110_SFC</p><p class="MsoNormal">printVarSummary(data)<br></p><p class="MsoNormal"><br></p><p class="MsoNormal">ariable: data<br>Type: float<br>Total Size: 2494464 bytes<br> 623616 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat_110 | 1344] x [lon_110 | 464]<br>Coordinates: <br> lat_110: [25.063..52.938]<br> lon_110: [-124.938..-67.063]</p><p class="MsoNormal"><br></p><p class="MsoNormal">=====</p><p class="MsoNormal"> LAT = (/ 48.5625 /) ; read from text file</p><p class="MsoNormal"> LAT@units = "degrees_north"<br></p><p class="MsoNormal"> LON = (/-98.9375/)</p><p class="MsoNormal"> LON&units = "degrees_east"<br></p><p class="MsoNormal"> npts = dimsizes(LAT)<br></p><p class="MsoNormal"><br></p><p class="MsoNormal">; Simple approx:</p><p class="MsoNormal"><br></p><p class="MsoNormal"> print( data(:,{LAT),{LON}) )</p><p class="MsoNormal">=====</p><p class="MsoNormal"><br></p><p class="MsoNormal">or better use:</p><p class="MsoNormal"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/linint2_points_<wbr>Wrap.shtml</a><br></p><p class="MsoNormal"><br></p><pre>points = <strong>linint2_points</strong>(data&lon,data&<wbr>lat,data, False, LON,LAT, 0)<br></pre><pre>printVarSummary(points)<br></pre><pre>print("--------------")<br></pre><p class="MsoNormal"><br></p><p class="MsoNormal">Good Luck<br></p></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Mar 9, 2018 at 9:37 AM, Smith, Stuart <span dir="ltr"><<a href="mailto:smit1770@purdue.edu" target="_blank">smit1770@purdue.edu</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div link="#0563C1" vlink="#954F72" lang="EN-US"><div class="m_6358384588061548899m_5558599136632736718WordSection1"><p class="MsoNormal">Hello,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I would like to compare two sets of forcing data. One is in a .grb file while the other is a .txt. When working the GRIB files (1 hour timesteps), I would like my .ncl script to reads in a time series of data, with the goal to plot specific weather data variables from specific locations to compare the .txt files. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">However, when running my .ncl script listed below I receive a Segmentation fault error. I’m not sure if this is because I am not defining the latitude and longitude coordinates soon enough, causing an error by reading in too much data. I do not know how to print or plot specific latitude (48.5625) and longitude (-98.9375) points and print their forcing variables. Could you please help improve my .ncl script? I have also uploaded an example of the .grb files I am working with. Thank you for your time.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">begin<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">;Go to directory of interest <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">diri = ncargpath("/depot/phig/apps/LI<wbr>S_VIC/NLDAS_Forcing/discover/<wbr>nobackup/projects/lis/MET_<wbr>FORCING/NLDAS2.FORCING/2009/<wbr>075/")<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">;list names of all of the files and add ful file path<u></u><u></u></p><p class="MsoNormal">grb_list = systemfunc("ls "+diri+"NLDAS_FORA0125_H.*.002<wbr>.grb") <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">;print(grb_list) ; make sure the desired files are listed in the correct order<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">; read in all files<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">grb_file = addfiles("grb_list","r")<u></u><u></u></p><p class="MsoNormal">ListSetType (grb_file, "join")<u></u><u></u></p><p class="MsoNormal">data = grb_file[:]->DSWRF_110_SFC<u></u><u></u></p><p class="MsoNormal">data@lat=grb_file[:]->lat_110 ;Lat. of interest 48.5625<u></u><u></u></p><p class="MsoNormal">data@lon=grb_file[:]->lon_110 ;Lon. of interest -98.9375<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">print(data)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">end<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Regards,<span class="m_6358384588061548899HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="m_6358384588061548899HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">-Stuart <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></font></span></div></div><br></div></div><span class="">______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>