<div dir="ltr"><div class="gmail_default" style="font-size:small">You can tell from your "print(c)" command what area the "c" variable covers:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px">Variable: c</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Type: float</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Total Size: 544320 bytes</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> 136080 values</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Number of Dimensions: 3</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Dimensions and sizes: [time | 360] x [lat | 14] x [lon | 27]</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Coordinates:</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> time: [15.5..10941.5]</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> lat: [25.18098640441895..49.</span><span style="font-family:arial,sans-serif;font-size:13px">42915344238281]</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> lon: [236.25.. 285]</span><br style="font-family:arial,sans-serif;font-size:13px"></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px">Note the lat array goes from 25.18 to 45.43, and the lon array from 236.25 to 285. This is in accordance with the range you selected via:</span></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px">c =a->tasmax(:,{25:50},{235:285}</span><span style="font-family:arial,sans-serif;font-size:13px">)<br></span><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-family:arial,sans-serif;font-size:13px">I'm not sure what you mean by "the middle coordinates of each grid cell". Do you mean the midpoint of the lat/lon coordinate arrays? This would be a simple subtraction and divide by 2:</span></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><font face="arial, sans-serif">nlon = dimsizes(c&lon)</font></div><div class="gmail_default"><font face="arial, sans-serif"><br></font></div>
<div class="gmail_default">lon_mid = c&lon(0:nlon-2) + (c&lon(1:) - c&lon(0:nlon-2))/2. </div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><font face="arial, sans-serif"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 6, 2014 at 7:47 AM, amit timilsina <span dir="ltr"><<a href="mailto:timilsinaamit87@huskers.unl.edu" target="_blank">timilsinaamit87@huskers.unl.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I have used the following commands to extract data of USA (print c, in this case). Please suggest me whether I am wrong or right. If print(c) covers the whole USA, I tried to write extracted file with command and created <a href="http://fout.nc" target="_blank">fout.nc</a> file. Is this is proper way to save my work? Moreover, Can we get the middle co-ordinates of each grid cell?<br>
Thanks in advance<br>
<br>
Commands:<br>
>ncl 3> a = addfile("tasmax_Amon_MPI-ESM-LR_decadal1980_r1i1p1_198101-201012.nc","r")<br>
>ncl 4> b =a->tasmax<br>
>ncl 5> c =a->tasmax(:,{25:50},{235:285})<br>
>ncl 6> print(c)<br>
>ncl>7>d = c<br>
>ncl>ncdf = addfile("<a href="http://fout.nc" target="_blank">fout.nc</a>"."c")<br>
>ncl>filedimdef(ncdf,"time",-1,True)<br>
>ncl>ncdf->c = d<br>
<br>
<br>
Output of print(b)<br>
<br>
Variable: b<br>
Type: float<br>
Total Size: 26542080 bytes<br>
6635520 values<br>
Number of Dimensions: 3<br>
Dimensions and sizes: [time | 360] x [lat | 96] x [lon | 192]<br>
Coordinates:<br>
time: [15.5..10941.5]<br>
lat: [-88.57216644287109..88.57216644287109]<br>
lon: [ 0..358.125]<br>
<br>
<br>
Output of print(c)<br>
<br>
Variable: c<br>
Type: float<br>
Total Size: 544320 bytes<br>
136080 values<br>
Number of Dimensions: 3<br>
Dimensions and sizes: [time | 360] x [lat | 14] x [lon | 27]<br>
Coordinates:<br>
time: [15.5..10941.5]<br>
lat: [25.18098640441895..49.42915344238281]<br>
lon: [236.25.. 285]<br>
Number Of Attributes: 11<br>
standard_name : air_temperature<br>
long_name : Daily Maximum Near-Surface Air Temperature<br>
comment : monthly mean of the daily-maximum near-surface air temperature.<br>
units : K<br>
cell_methods : time: maximum within days time: mean over days<br>
cell_measures : area: areacella<br>
history : 2011-11-09T08:48:40Z altered by CMOR: Treated scalar dimension: 'height'.<br>
coordinates : height<br>
missing_value : 1e+20<br>
_FillValue : 1e+20<br>
associated_files : baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_atmos_fx_MPI-ESM-LR_decadal1980_r0i0p0.nc areacella: areacella_fx_MPI-ESM-LR_decadal1980_r0i0p0.nc<br>
(0,0,0) 291.8939<br>
(0,0,1) 291.681<br>
(0,0,2) 292.1985<br>
(0,0,3) 293.3919<br>
(0,0,4) 294.4564<br>
(0,0,5) 295.4993<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<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><br>
</blockquote></div><br></div>