<div dir="ltr">I don't really know the issue. What does printVarSummary(a[0]-><span>SWDDNI) reveal about coordinates and shape of that variable? Are you getting the warning nfiles number of times?<br><br><br></span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 26, 2017 at 10:28 AM, Vanúcia Schumacher <span dir="ltr"><<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.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 id="m_-8776778260989494147divtagdefaultwrapper" style="font-size:14pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>The line 19 corresponds: </p><span class="">
<p><br>
</p>
<p><span> rad = wrf_user_getvar(a[k],"SWDDNI",<wbr>-1)</span><br>
</p>
<p><span><br>
</span></p>
</span><p><span>with the warming:</span></p><span class="">
<p><span></span></p>
<div>VarVarWrite: rhs has no coordinate variable for dimension number (0), destroying coordinate var, use "(/../)" if this is not desired outcome</div>
<div><br>
</div>
<br>
<p></p>
</span></div>
<hr style="display:inline-block;width:98%">
<div id="m_-8776778260989494147divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Enviado:</b> segunda-feira, 26 de junho de 2017 13:21:06<br>
<b>Para:</b> Vanúcia Schumacher<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Assunto:</b> Re: [ncl-talk] problems with loop</font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
</div>
The notation <span>Rad_in(<span style="color:rgb(255,0,0)">i</span>,:,:) is causing the projection from 3D down to 2D. If you want to preserve the 3D shape, use
</span><br>
<span>Rad_in(<span style="color:rgb(255,0,0)">i:i</span>,:,:).<br>
<br>
</span></div>
<span>I'm not sure about the warning. Did you post your entire script, i.e., does line #17 correspond to "</span><span>alb = 0.7*Rad_in(i,:,:)<span class="m_-8776778260989494147gmail-m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">" ?<br>
<br>
</span></span></div>
<span><span class="m_-8776778260989494147gmail-m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">Rick<br>
</span></span></div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jun 26, 2017 at 8:55 AM, Vanúcia Schumacher <span dir="ltr">
<<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.<wbr>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 id="m_-8776778260989494147m_-7133804297329241900divtagdefaultwrapper" style="font-size:14pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi NCL users,</p>
<p><br>
</p>
<p></p>
<div>I need to calculate a variable based on a parameter that varies with time.</div>
<div>For the first year the value of the parameter is 0.7</div>
<div>For the second year the parameter is 0.4</div>
<div>For the third year onwards the parameter is 0.3</div>
<div><br>
</div>
<div>So I must multiply the variable with the value of the parameter and I want to get a new variable with all the coordinates (time, lat and lon), b<span>ut I'm having the variable only with lat and lon and getting the following warning:</span></div>
<div><span><br>
</span></div>
<div><span>
<div>warning:VarVarWrite: rhs has no coordinate variable for dimension number (0), destroying coordinate var, use "(/../)" if this is not desired outcome</div>
<div>warning:["Execute.c":8640]:Exe<wbr>cute: Error occurred at or near line 17 in file test.ncl</div>
<div><br>
</div>
<div><br>
</div>
<div>My script:</div>
<div>( here in this test, my time is 3 days (average from 12 files), so the parameter<span> is varying for 1 day = 0.7, 2 day = 0.4, and 3 day =0.3</span></div>
<div><br>
</div>
<div> files = systemfunc("ls -1 wrfout_d01_*") + ".nc"</div>
<div> a = addfiles(files,"r") </div>
<div> nfiles = dimsizes(files) </div>
<div><br>
</div>
<div><span style="font-size:14pt">do k = 0,nfiles-1</span><br>
</div>
<div><br>
</div>
<div> rad = wrf_user_getvar(a[k],"SWDDNI",<wbr>-1)<span style="font-size:14pt"> </span></div>
<div> rad&Time = wrf_times_c(a[k]->Times, 0) </div>
<div> Rad_in = calculate_daily_values(rad, "avg", 0, False) </div>
<div> </div>
<div> times = wrf_user_getvar(a[k],"times",-<wbr>1) </div>
<div> ntimes = dimsizes(times) </div>
<div> <span style="font-size:14pt"> </span></div>
<div>do i = 0, ntimes-1</div>
<div> </div>
<div> if (i.lt.2) then<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span></div>
<div><span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap"></span>alb = 0.7*Rad_in(i,:,:)<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span></div>
<div> end if</div>
<div><br>
</div>
<div> if (i.gt.2.and.i.lt.3) then </div>
<div> alb = 0.4*Rad_in(i,:,:)</div>
<div> end if</div>
<div><br>
</div>
<div> if (i.gt.3) then </div>
<div> alb = 0.3*Rad_in(i,:,:)</div>
<div> end if<span style="font-size:14pt"> </span></div>
<div>end do <span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span></div>
<div>end do</div>
<div> </div>
<div>
<div>Variable: nfiles</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div> 1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes:<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>[1]</div>
<div>Coordinates: </div>
<div>(0)<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>12</div>
<div><br>
</div>
</div>
<div>
<div>Variable: rad</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div> 1400 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes:<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>[Time | 1] x [south_north | 50] x [west_east | 28]</div>
<div>Coordinates: </div>
<div>Number Of Attributes: 6</div>
<div> coordinates :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>XLONG XLAT</div>
<div> stagger :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span></div>
<div> units :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>W/m^2</div>
<div> description :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>Shortwave surface downward direct normal irradiance</div>
<div> MemoryOrder :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>XY </div>
<div> FieldType :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>104</div>
<div><br>
</div>
<div>Variable: Rad_in</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div> 1400 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes:<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>[Time | 1] x [south_north | 50] x [west_east | 28]</div>
<div>Coordinates: </div>
<div> Time: [ 0.. 0]</div>
<div>Number Of Attributes: 9</div>
<div> NCL_tag :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>calculate_daily_values: arith=avg</div>
<div> Time :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span> 0</div>
<div> FieldType :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>104</div>
<div> MemoryOrder :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>XY </div>
<div> description :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>Shortwave surface downward direct normal irradiance</div>
<div> units :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>W/m^2</div>
<div> stagger :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span></div>
<div> coordinates :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>XLONG XLAT</div>
<div> _FillValue :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>9.96921e+36</div>
<div><br>
</div>
<div><br>
</div>
<div>Variable: ntimes</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div> 1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes:<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>[1]</div>
<div>Coordinates: </div>
<div>(0)<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>1</div>
<div><br>
</div>
<div>Variable: alb</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div> 1400 values</div>
<div>Number of Dimensions: 2</div>
<div>Dimensions and sizes:<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>[50] x [28]</div>
<div>Coordinates: </div>
<div>Number Of Attributes: 1</div>
<div> _FillValue :<span class="m_-8776778260989494147m_-7133804297329241900Apple-tab-span" style="white-space:pre-wrap">
</span>9.96921e+36</div>
<div><br>
</div>
<br>
</div>
<div><span>Is there any other way I can do this? Thanks any help</span><br>
</div>
<br>
</span></div>
<div><span><br>
</span></div>
<p></p>
</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>