<div dir="ltr"><div dir="ltr">Debasish, you have this at the start of your program:<br></div><div dir="ltr"><br></div><div dir="ltr"> obs_lat = z->hdr_lat ; indexed by nhdr<br> obs_lon = z->hdr_lon ; indexed by nhdr<br> obs_hid = z->obs_hid ; indexed by nobs<br><br>However, the first two lines are not right. You need obs coordinates indexed by the obs index, not the header index. As you already said, "obs_hid" cross-references the obs index to the header index. NCL will conveniently cross-reference the coordinates by using vector subscripting.<br><br> hdr_lat = z->hdr_lat<br> hdr_lon = z->hdr_lon<br> obs_hid = z->obs_hid<br><br> obs_lat = (/ hdr_lat(obs_hid(:)) /) ; now indexed by nobs<br> obs_lon = (/ hdr_lon(obs_hid(:)) /) ; now indexed by nobs</div><div dir="ltr"><br></div><div dir="ltr">After this, use only the new obs_lat and obs_lon for station coordinates in the rest of the program. The only other obs variables that you should need for plotting are obs_vid to select only the PM2.5 values, and obs_val for the actual data values.<br></div><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Jul 24, 2026 at 10:29 PM Debasish Hazra <<a href="mailto:debasish.hazra5@gmail.com">debasish.hazra5@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"><div>Thanks Dave. Made some inroads related to the input file. As there can be multiple variables stored for each station, that is why the number of observations is larger. obs_var is the list of possible variables and obs_vid is for the index of the obs_var for each observation value. There is also the obs_hid, which lists the index of the header variables, including lat/lon/etc for each observation. Attached is an input file, with ncl program with more print statements to show obs_var, obs_vid and an output txt file that shows print statements output. </div><div>So in this case, based on obs_vars, trying to read pm25 (2nd variable in obs_vars), with corresponding obs_vids and obs_val and then group them in selected bins to overlay on map. Any help on this is appreciated</div><div>Thanks,</div><div>Debasish</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2026 at 2:43 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@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"><div dir="ltr">Debasish,<span> the problem starts with the Airnow input file. It has obs_lat and obs_lon on dimension nhdr, but pm25_data is on dimension nobs. These are two different sizes. From the Airnow file, can you determine how to line up the coordinates for each of the 3982 obs values? My guess is that there is some kind of cross referencing in the Airnow file, such as site ID arrays.</span><br></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2026 at 11:20 AM Debasish Hazra <<a href="mailto:debasish.hazra5@gmail.com" target="_blank">debasish.hazra5@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">Thanks Dave, attached the revised ncl code with print statements you have suggested along with print output and error in text message. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2026 at 12:51 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@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"><div dir="ltr">Debasish, please check your subscripting. Immediately before the line that gets the error, add printVarSummary for lat_new, obs_lat, and "indexes". Also include:</div><div dir="ltr"><br></div><div dir="ltr"> printMinMax (indexes, 0)</div><div dir="ltr"> print ("num missing = " + num (ismissing (indexes)))</div><div dir="ltr"> print (i)</div><div dir="ltr"> print (npts_range)</div><div dir="ltr"><br></div><div dir="ltr">Show us all of this output immediately preceding the error, including the error message itself. Do not show repeated outputs, only the last set of debug print messages before the error occurs.<br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2026 at 8:05 AM Debasish Hazra via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.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>Thanks Karin for your reply. The file is big to attach, here is the link of actual file : <a href="https://nomads.ncep.noaa.gov/pub/data/nccf/com/gens/prod/gefs.20260718/00/chem/pgrb2ap25/" target="_blank">https://nomads.ncep.noaa.gov/pub/data/nccf/com/gens/prod/gefs.20260718/00/chem/pgrb2ap25/</a></div><div>I am getting error in this line : lat_new(i,0:npts_range-1) = obs_lat(indexes)</div><div>error says : fatal:Subscript out of range, error in subscript #0<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 68 in file Test_read.ncl<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2026 at 3:17 AM Karin Meier-Fleischer <<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</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">Hi Debasish,<br>
<br>
the file gefs.chem.t00z.a2d_0p25.f018.grib2 is missing.<br>
<br>
Can you provide more Information about the error.<br>
<br>
Regards, Karin<br>
<br>
Am 18.07.26 um 04:26 schrieb Debasish Hazra via ncl-talk:<br>
> Hi,<br>
> I am trying to do a plot with station data in netcdf overlay on model <br>
> output following this example here <br>
> :<a href="https://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl" rel="noreferrer" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl</a><br>
> But getting subscript range error. Attached is the ncl code and netcdf <br>
> station data used for this. Any help on this is greatly appreciated.<br>
><br>
> Thanks<br>
> Debasish</blockquote></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>