<div dir="ltr">Sorry, To my knowledge, the short answer is "no". Sorry. D</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 15, 2016 at 2:28 PM, Sourav Chatterjee <span dir="ltr"><<a href="mailto:srvsxc@outlook.com" target="_blank">srvsxc@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div style="font-family:Calibri,sans-serif;font-size:11pt">Thanks alot Dennis<br>
<br>
<br>
Is there any way to average this variable only with latitude? I have done after regriding using ESMF_regrid function, but is it possible without regriding this temperature variable?<br>
<br>
I want to plot a depth vs longitude contour plot averaged over time and latitude.<br>
<br>
Regards<br>
Sourav</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:shea@ucar.edu" target="_blank">Dennis Shea</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">13-09-2016 17:11</span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:srvsxc@outlook.com" target="_blank">Sourav Chatterjee</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Cc:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>;
<a href="mailto:guidocioni@gmail.com" target="_blank">Guido Cioni</a></span><div><div class="h5"><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">Re: [ncl-talk] Assign lat lon cordinates to polar stereographic coordinate</span><br>
<br>
</div></div></div><div><div class="h5">
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>See:<br>
<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/getind_latlon2d.<wbr>shtml</a><br>
</div>
and/or<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/region_ind.shtml</a><br>
<br>
</div>
Then<br>
<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave2.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>wgt_areaave2.shtml</a><br>
<br>
</div>
Ideally, the weights (areas represented by each grid point) would be available in 'some file.' Or, perhaps you could construct them<br>
<br>
</div>
or, perhaps, just use <br>
<br>
</div>
wgt2d = cos(rsd*lat2d) ; rad converts degrees to radians<br>
<br>
</div>
Good luck<br>
<div>
<div><br>
<br>
<div>
<div><br>
<br>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Sep 13, 2016 at 2:19 AM, Guido Cioni <span dir="ltr">
<<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Also make sure to perform the short to float conversion before working with your data!!!
<div><br>
</div>
<div><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Contributed/<wbr>short2flt.shtml</a><span><font color="#888888"><br>
<div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
Guido Cioni</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<a href="http://guidocioni.altervista" target="_blank">http://guidocioni.altervista</a>.o<wbr>rg</div>
</div>
</font></span>
<div>
<div><br>
<div>
<blockquote type="cite">
<div>On 13 Sep 2016, at 10:15, Guido Cioni <<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>> wrote:</div>
<br>
<div>
<div style="word-wrap:break-word">
<div>Assuming from your filedump you do have coordinate variables associated, so the following should easily work.</div>
<div><br>
</div>
<div><font face="Menlo">temp_avg=dim_avg_n_Wrap(temp(:<wbr>,:,{40:50},{-30:-10}),(/2,3/))</font></div>
<div><br>
</div>
<div>Otherwise you would have to convert the latitude/longitude variables from 2D to 1D, use the ind function to find all the indices that map into your box, convert again into 2D indices with ind_resolve, subset temp with these indices, do the average. </div>
<div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
Guido Cioni</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<a href="http://guidocioni.altervista/" target="_blank">http://guidocioni.altervista</a>.o<wbr>rg</div>
</div>
<br>
<div>
<blockquote type="cite">
<div>On 13 Sep 2016, at 09:10, Sourav Chatterjee <<a href="mailto:srvsxc@outlook.com" target="_blank">srvsxc@outlook.com</a>> wrote:</div>
<br>
<div>
<div>
<div>
<div style="font-family:Calibri,sans-serif;font-size:11pt">Thanks alot Mary for the explanation.<br>
<br>
Actually I need to do some area averaging for which I have the lat lon information e.g say, surface temperature averaged over 40-50N and -30:-10E. How to perform this spatial averaging with this temperature(time,depth,y,x) variable?<br>
<br>
Thanks<br>
Sourav<br>
</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:haley@ucar.edu" target="_blank">Mary Haley</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">12-09-2016 23:38</span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:srvsxc@outlook.com" target="_blank">Sourav Chatterjee</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Cc:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif;font-size:11pt">Re: [ncl-talk] Assign lat lon cordinates to polar stereographic coordinate</span><br>
<br>
</div>
<div>
<div dir="ltr">
<div class="gmail_default"><font face="arial, helvetica, sans-serif">Sourav,</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">I'm not sure what you mean by "converting my variable".</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">Since your latitude and longitude arrays are two-dimensional, you cannot associate them with "temperature" in the same way that "y" and "x" are currently associated with "temperature" as coordinate
variables. This is a NetCDF limitation that requires that coordinate variables be one-dimensional and the same length as the dimension they represent.</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">You already have a "coordinates" *attribute* associated with "temperature", that indicates which variables represent the lat/lon arrays for your data:</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><span> temperature:coordinates = "longitude latitude" ;</span><br>
</font></div>
<div class="gmail_default"><span><font face="arial, helvetica, sans-serif"><br>
</font></span></div>
<div class="gmail_default"><span><font face="arial, helvetica, sans-serif">This is how we would normally suggest that you "associate" 2D lat/lon arrays with a variable on a NetCDF file, so really, your "temperature" variable looks pretty good as it is.</font></span></div>
<div class="gmail_default"><span><font face="arial, helvetica, sans-serif"><br>
</font></span></div>
<div class="gmail_default"><span><font face="arial, helvetica, sans-serif">--Mary</font></span></div>
<div class="gmail_default"><span><font face="arial, helvetica, sans-serif"><br>
</font></span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Sep 9, 2016 at 4:19 AM, Sourav Chatterjee <span dir="ltr">
<<a href="mailto:srvsxc@outlook.com" target="_blank">srvsxc@outlook.com</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 style="font-size:12pt;background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all</p>
<p><br>
</p>
<p>I want convert my variable (temperature) to temperature (time,depth,lat,lon) from temperature(time,depth,x,y)
<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>here is how it looks like now.</p>
<p><br>
</p>
<p>Any help!</p>
<p><br>
</p>
<p>Thanks<br>
</p>
<p><br>
</p>
<div><span></span><br>
</div>
<div>dimensions:<br>
depth = 12 ;<br>
time = UNLIMITED ; // (288 currently)<br>
x = 428 ;<br>
y = 403 ;<br>
variables:<br>
int stereographic ;<br>
stereographic:grid_mapping_na<wbr>me = "polar_stereographic" ;<br>
stereographic:latitude_of_pro<wbr>jection_origin = 90. ;<br>
stereographic:longitude_of_pr<wbr>ojection_origin = -45. ;<br>
stereographic:scale_factor_at<wbr>_projection_origin = 1. ;<br>
stereographic:straight_vertic<wbr>al_longitude_from_pole = -45. ;<br>
stereographic:false_easting = 0. ;<br>
stereographic:false_northing = 0. ;<br>
float x(x) ;<br>
x:axis = "X" ;<br>
x:standard_name = "projection_x_coordinate" ;<br>
x:units = "100 km" ;<br>
float y(y) ;<br>
y:standard_name = "projection_y_coordinate" ;<br>
y:axis = "Y" ;<br>
y:units = "100 km" ;<br>
float depth(depth) ;<br>
depth:long_name = "depth" ;<br>
depth:units = "m" ;<br>
depth:standard_name = "depth" ;<br>
depth:positive = "down" ;<br>
depth:axis = "Z" ;<br>
double time(time) ;<br>
time:units = "hour since 1950-1-1T00:00:00Z" ;<br>
time:long_name = "forecast time" ;<br>
float longitude(y, x) ;<br>
longitude:standard_name = "longitude" ;<br>
longitude:units = "degrees_east" ;<br>
float latitude(y, x) ;<br>
latitude:standard_name = "latitude" ;<br>
latitude:units = "degrees_north" ;<br>
short temperature(time, depth, y, x) ;<br>
temperature:_FillValue = -32767s ;<br>
temperature:missing_value = -32767s ;<br>
temperature:add_offset = 23.5 ;<br>
temperature:scale_factor = 0.000808839239385893 ;<br>
temperature:units = "Celsius" ;<br>
temperature:standard_name = "sea_water_potential_temperatu<wbr>re" ;<br>
temperature:grid_mapping = "stereographic" ;<br>
temperature:coordinates = "longitude latitude" ;<br>
temperature:cell_methods = "area: mean" ;<br>
<br>
// global attributes:<br>
:title = "Arctic Ocean Physics Reanalysis (1991-2014), 12.5km monthly mean (dataset-ran-arc-myoceanv2-be)<wbr>" ;<br>
:institution = "NERSC, Thormoehlens gate 47, N-5006 Bergen, Norway" ;<br>
:history = "20160112:Created by program hyc2proj, version V0.3" ;<br>
:source = "NERSC-HYCOM model fields" ;<br>
:references = "<a href="http://topaz.nersc.no/" target="_blank">http://topaz.nersc.no</a>" ;<br>
:field_type = "Files based on file type nersc_weekly" ;<br>
:Conventions = "CF-1.4" ;<br>
:field_date = "2014-11-15" ;<br>
:bulletin_date = "2014-11-15" ;<br>
}<br>
</div>
<br>
<div><br>
</div>
</div>
</div>
<br>
______________________________<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>
</blockquote>
</div>
<br>
</div>
</div>
</div>
______________________________<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" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
<br>
______________________________<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>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</blockquote></div><br></div>