<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" 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, &nbsp;use &quot;(/../)&quot; if this is not desired outcome</div>
<div>warning:[&quot;Execute.c&quot;:8640]:Execute: 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>&nbsp;is varying for 1 day =&nbsp;0.7, &nbsp;2&nbsp;day = 0.4, and 3 day =0.3</span></div>
<div><br>
</div>
<div>&nbsp;files = systemfunc(&quot;ls -1 wrfout_d01_*&quot;) &#43; &quot;.nc&quot;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a = addfiles(files,&quot;r&quot;) &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; nfiles = dimsizes(files) &nbsp;</div>
<div><br>
</div>
<div><span style="font-size: 14pt;">do k = 0,nfiles-1</span><br>
</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;rad = wrf_user_getvar(a[k],&quot;SWDDNI&quot;,-1)<span style="font-size: 14pt;">&nbsp; &nbsp; &nbsp;</span></div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;rad&amp;Time = wrf_times_c(a[k]-&gt;Times, 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;Rad_in = calculate_daily_values(rad, &quot;avg&quot;, 0, False)&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp;times = wrf_user_getvar(a[k],&quot;times&quot;,-1) &nbsp;</div>
<div>&nbsp; &nbsp; ntimes = dimsizes(times) &nbsp; &nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 14pt;">&nbsp; &nbsp;&nbsp;</span></div>
<div>do i = 0, ntimes-1</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; if &nbsp;(i.lt.2) then<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>alb = 0.7*Rad_in(i,:,:)<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div>&nbsp; &nbsp; &nbsp; end if</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; if (i.gt.2.and.i.lt.3) then&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alb = 0.4*Rad_in(i,:,:)</div>
<div>&nbsp; &nbsp; &nbsp; end if</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; if (i.gt.3) then&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alb = 0.3*Rad_in(i,:,:)</div>
<div>&nbsp; &nbsp; &nbsp; end if<span style="font-size: 14pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></div>
<div>end do <span class="Apple-tab-span" style="white-space:pre"></span></div>
<div>end do</div>
<div>&nbsp;</div>
<div>
<div>Variable: nfiles</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre"> </span>
[1]</div>
<div>Coordinates:&nbsp;</div>
<div>(0)<span class="Apple-tab-span" style="white-space:pre"> </span>12</div>
<div><br>
</div>
&nbsp;</div>
<div>
<div>Variable: rad</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1400 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre"> </span>
[Time | 1] x [south_north | 50] x [west_east | 28]</div>
<div>Coordinates:&nbsp;</div>
<div>Number Of Attributes: 6</div>
<div>&nbsp; coordinates :<span class="Apple-tab-span" style="white-space:pre"> </span>
XLONG XLAT</div>
<div>&nbsp; stagger :<span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div>&nbsp; units :<span class="Apple-tab-span" style="white-space:pre"> </span>W/m^2</div>
<div>&nbsp; description :<span class="Apple-tab-span" style="white-space:pre"> </span>
Shortwave surface downward direct normal irradiance</div>
<div>&nbsp; MemoryOrder :<span class="Apple-tab-span" style="white-space:pre"> </span>
XY&nbsp;</div>
<div>&nbsp; FieldType :<span class="Apple-tab-span" style="white-space:pre"> </span>104</div>
<div><br>
</div>
<div>Variable: Rad_in</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1400 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre"> </span>
[Time | 1] x [south_north | 50] x [west_east | 28]</div>
<div>Coordinates:&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time: [ &nbsp; 0.. &nbsp; 0]</div>
<div>Number Of Attributes: 9</div>
<div>&nbsp; NCL_tag :<span class="Apple-tab-span" style="white-space:pre"> </span>calculate_daily_values: arith=avg</div>
<div>&nbsp; Time :<span class="Apple-tab-span" style="white-space:pre"> </span>&nbsp; 0</div>
<div>&nbsp; FieldType :<span class="Apple-tab-span" style="white-space:pre"> </span>104</div>
<div>&nbsp; MemoryOrder :<span class="Apple-tab-span" style="white-space:pre"> </span>
XY&nbsp;</div>
<div>&nbsp; description :<span class="Apple-tab-span" style="white-space:pre"> </span>
Shortwave surface downward direct normal irradiance</div>
<div>&nbsp; units :<span class="Apple-tab-span" style="white-space:pre"> </span>W/m^2</div>
<div>&nbsp; stagger :<span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div>&nbsp; coordinates :<span class="Apple-tab-span" style="white-space:pre"> </span>
XLONG XLAT</div>
<div>&nbsp; _FillValue :<span class="Apple-tab-span" style="white-space:pre"> </span>9.96921e&#43;36</div>
<div><br>
</div>
<div><br>
</div>
<div>Variable: ntimes</div>
<div>Type: integer</div>
<div>Total Size: 4 bytes</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre"> </span>
[1]</div>
<div>Coordinates:&nbsp;</div>
<div>(0)<span class="Apple-tab-span" style="white-space:pre"> </span>1</div>
<div><br>
</div>
<div>Variable: alb</div>
<div>Type: float</div>
<div>Total Size: 5600 bytes</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1400 values</div>
<div>Number of Dimensions: 2</div>
<div>Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre"> </span>
[50] x [28]</div>
<div>Coordinates:&nbsp;</div>
<div>Number Of Attributes: 1</div>
<div>&nbsp; _FillValue :<span class="Apple-tab-span" style="white-space:pre"> </span>9.96921e&#43;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>
</body>
</html>