<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.m6358384588061548899hoenzb
{mso-style-name:m_6358384588061548899hoenzb;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Not a problem. Thank you for your assistance Dennis, and providing feedback on my mistakes. This is very helpful. Thank you for your time, and have a nice day.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>-Stuart<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Dennis Shea [mailto:shea@ucar.edu] <br><b>Sent:</b> Friday, March 9, 2018 4:40 PM<br><b>To:</b> Smith, Stuart <smit1770@purdue.edu><br><b>Cc:</b> Ncl-talk <ncl-talk@ucar.edu><br><b>Subject:</b> Re: [ncl-talk] Extracting A Time Series of Forcing Data Information from Specific Locations<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Apologies: I was in too much of a rush.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>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>==========<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>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<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br><br><br><br><o:p></o:p></p><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p></div></div></div></div></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Mar 9, 2018 at 1:59 PM, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>[1]<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>The following is incorrect. grb_list is a one-dimensional *array* of file names containing strings (text). You have it as a single string.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> grb_file = addfiles("grb_list","r") <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Use <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> grb_file = addfiles( grb_list ,"r") ; pass the 1-d array of file names<o:p></o:p></p><p class=MsoNormal>=============<br>[2]<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>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]<o:p></o:p></p><div><p class=MsoNormal><br>diri = ncargpath("/depot/phig/apps/LIS_VIC/NLDAS_Forcing/discover/nobackup/projects/lis/MET_FORCING/NLDAS2.FORCING/2009/075/")<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>grb_file = addfiles("grb_list","r")<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>data = grb_file[:]->DSWRF_110_SFC<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>printVarSummary(data)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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]<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>=====<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> LAT = (/ 48.5625 /) ; read from text file<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> LAT@units = "degrees_north"<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> LON = (/-98.9375/)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> LON&units = "degrees_east"<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> npts = dimsizes(LAT)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>; Simple approx:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> print( data(:,{LAT),{LON}) )<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>=====<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>or better use:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml</a><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><pre>points = <strong><span style='font-family:"Courier New"'>linint2_points</span></strong>(data&lon,data&lat,data, False, LON,LAT, 0)<o:p></o:p></pre><pre>printVarSummary(points)<o:p></o:p></pre><pre>print("--------------")<o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Good Luck<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Mar 9, 2018 at 9:37 AM, Smith, Stuart <<a href="mailto:smit1770@purdue.edu" target="_blank">smit1770@purdue.edu</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hello,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>begin<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>;Go to directory of interest <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>diri = ncargpath("/depot/phig/apps/LIS_VIC/NLDAS_Forcing/discover/nobackup/projects/lis/MET_FORCING/NLDAS2.FORCING/2009/075/")<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>;list names of all of the files and add ful file path<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>grb_list = systemfunc("ls "+diri+"NLDAS_FORA0125_H.*.002.grb") <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>;print(grb_list) ; make sure the desired files are listed in the correct order<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>; read in all files<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>grb_file = addfiles("grb_list","r")<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>ListSetType (grb_file, "join")<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>data = grb_file[:]->DSWRF_110_SFC<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>data@lat=grb_file[:]->lat_110 ;Lat. of interest 48.5625<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>data@lon=grb_file[:]->lon_110 ;Lon. of interest -98.9375<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>print(data)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>end<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Regards,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'>-Stuart <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'> <o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'>_______________________________________________<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" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>