<div dir="ltr"><div><div><div><div><div><div><div>To expand on DaveA's response.<br>===========================<br><br></div>[1] <br>You can only use coordinate subscripts and the associated syntax operators ( &, {...}) with 'coordinate variables'<br></div>The file you are using has coordinate variables 'time', 'x' and 'y'. The units of 'x' and 'y' are meters.<br></div>If you could specify the appropriate locations in **meters**, you could use the meters. Hpwever, this is unusual and a bit awkward.<br><br></div>[2] <br>The file does have' lat(y, x)' and 'lon(y,x)'. These are curvilinear coordinates. I am sure the graphics portion of the NCL Workshop explained how to plot 2d curvilinear coordinates:<br><br></div><div> lat2d = f->lat<br></div><div> lon2d= f->lon<br></div><div><br></div> [a] Use the reserved attributes 'lat2d' or 'lon2d'<br></div> There are many examples illustrating this approach.<br><br></div><div> t@lat2d = lat2d<br></div><div> t@lon2d = on2d<br></div><div>or<br><br></div> [b] Set the 'sfXArray', 'sfYArray'<br><pre> res@sfXArray = lon2d
res@sfYArray = lat2d<br><br></pre><pre> Please see the workshop graphics note. <br><br>[3]<br></pre><pre>If you want to subset the array, you must use index (subscript) values.<br></pre><pre>As noted by Dave, you will have to use efunctions to determin the subregion:<br><br><br> <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtm">http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtm</a><br></pre><pre><br></pre>Good luck<br><div><div><div><div><div><div><div><div><div><div><div><br><br></div></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 3:41 PM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</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"><span style="font-size:14px">Jothiganesh,</span><br><div><br></div><div><span class=""><div>> 1) Is there a way to do the subscripting in the EOF code</div><div>> by defining lon and lat instead of x and y.</div><div><br></div></span><div>Yes. Please see the region_ind function.<br><br></div><span class=""><div>> 2) Also, the output netcdf file of EOF does not have the</div></span><div>> lon, lat meta data. Instead it has x and y, which does not</div><span class=""><div>> overlay when I tried with NARR plot.</div><div><br></div></span></div><div><span style="font-size:14px">I already mentioned the solution. You need to copy or retain the 2-dimensional lat and lon arrays from the input file to the output file. Then create a plot with the </span>projection methods in NARR example 4, which utilize the 2-D lat and lon arrays.</div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">Alternatively you can copy the Lambert projection parameters and use the native grid plot method, as in NARR example 1. But I recommend against this method because it is prone to subtle offset errors.</span></div><div><br></div><div>Can anyone point us to concise basic documentation for how 2-D coordinates are structured in a Netcdf file? The CF website does not include a concise explanation of 2-D geographic coordinates.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Dave</div></font></span><div><div class="h5"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 16, 2015 at 9:00 PM, Jothi Ganesh Shanmuga Sundaram <span dir="ltr"><<a href="mailto:joshanmugasundaram@mix.wvu.edu" target="_blank">joshanmugasundaram@mix.wvu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Thanks a lot Dave. It's helpful. I tried running without any coordinate script, it is running and I was able to generate the EOF and EOF-time series netcdf files for the entire domain. I am interested in coordinate subscripting as in the EOF example 1. <br><br>When I tried to enter the lon lat ranges, the script does not run. It says lon is not a dimension or variable. It accepts x or y, but x and y are some strange values in the data. If I type ncl_filedump file -v lon, I see the values. <br><br></div><div>Here is the ncl_filedump summary.<br></div><div><br>short air ( time, y, x )<br>..<br>float lat ( y, x )<br>....<br></div><div>float lon ( y, x )<br><br>1) Is there a way to do the subscripting in the EOF code by defining lon and lat instead of x and y.<br><br></div><div>2) Also, the output netcdf file of EOF does not have the lon, lat meta data. Instead it has x and y, which cannot does not overlay when I tried with NARR plot.<br><br></div><div>Here is my script.<br><br>;Read the NARR data (Air temperature at 2m)<br>f = addfile ("<a href="http://air.2m.mon.mean.nc" target="_blank">air.2m.mon.mean.nc</a>", "r")<br> <br>;Define the parameter, convert the format short to float<br> p = short2flt(f->air(::12,:,:))<br><br>;Calculate the weights<br>w = sqrt(cos(0.01745329*p&y)) ; p&y works, but if i enter p&lat, it does not work.<br>wp = p*conform(p, w, 1)<br>copy_VarCoords(p, wp)<br><br>t = wp(y|:,x|:,time|:) ; x and y works, but if i enter lon or lat, it does not work.<br><br>;Number of EOF to be calculated<br>neof = 3<br><br>;NCL EOF functions <br>eof = eofunc_Wrap(t, neof, False) ;EOF (3modesXlonXlat)<br>eof_ts = eofunc_ts_Wrap (t, eof, False) ;EOF (3modesXtime)<br><br>;Export EOF spatial data as netcdfile<br>system ("/bin/rm -f EOFnarr.nc") <br>fout = addfile ("EOFnarr.nc", "c")<br>fout@title = "EOFs of pre 1971-2013"<br>fout->EOF = eof<br><br></div><div>Regards<br></div><div>Jothiganesh<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 16, 2015 at 9:58 PM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Jothiganesh,<div><br></div><div>Yes you can directly read NARR data and compute EOF's without regridding. The underlying EOF functions eofunc and eofunc_ts do not use any spatial coordinates. They operate purely on numeric arrays.<br></div><div><br></div><div>The first EOF example uses coordinate subscripting and the lonFlip function. If you remove both of these methods from the example, then you can compute EOF's over the entire NARR grid.</div><div><br></div><div>However, to generate valid plots, you will need to retain the NARR coordinate metadata, and modify the plot section to use one of the plotting methods shown on the NARR examples page.</div><div><br></div><div>I recommend one of the projection methods in NARR example 4, because they use the retained 2-D coordinate grids to directly align the data with the underlying map. After you get that working, you can switch back to Lambert or some other projection of your choice.</div><div class="gmail_extra"><br></div><div class="gmail_extra">--Dave<br><br><br><div class="gmail_quote"><div><div>On Tue, Jun 16, 2015 at 6:39 PM, Jothi Ganesh Shanmuga Sundaram <span dir="ltr"><<a href="mailto:joshanmugasundaram@mix.wvu.edu" target="_blank">joshanmugasundaram@mix.wvu.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div>Hello,<br><br></div>I use NARR gridded data (349x277 Lambert Conformal Conic grid) in netcdf format in NCL. I am able to plot graphics without any problem using the existing script in NCL website.<br><br></div>I want to do EOF analysis with NARR data. When I tried to use the EOF script available from NCL website to analyze NARR data, it is not working. When I checked the data using ncl_file dump the lon, lat formats are very different. My question is<br><br></div>1) Whether I can do EOF analysis in NCL by directly reading NARR data? If so, I cannot define the LON LAT value, as NARR has a projected coordinates value?<br><br>2) Do I need to regrid the NARR curvilinear to rectlinear data before doing EOF? or Is there a way to convert the format of LON, LAT in grid without regridding inorder to do EOF analysis in NCL<br><br></div>Thanks for your help.<br><br></div>Regards<br></div>Jothiganesh </div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div></div></div></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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>
<br></blockquote></div><br></div>