<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Dear NCL users:
<div><br>
</div>
<div>I have been able to append to an existing netcdf file before easily with an unlimited time dimension. However, something has changed as my old scripts no longer work. I have tried so many combinations unsuccessfully. This seems more difficult than it needs
to be. So I create the netcdf file with (time, lat, lon) with time unlimited, add variables -- this works fine. However, if I want to append an additional time step or several at once -- no dice. Below is a snip of my code. Note the if condition is the initial
create, and else condition is the append which fails.</div>
<div><br>
</div>
<div>thanks for the help,</div>
<div>Matt</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>if (it.eq.0) then</div>
<div><br>
</div>
<div> outncdf = addfile(_outpath+varname+".nc" ,"c")</div>
<div> dimNames = (/"time","south_north","west_east"/)</div>
<div> dimSizes = (/ -1, ny, nx /)</div>
<div> dimUnlim = (/ True, False, False /)</div>
<div> filedimdef(outncdf,dimNames,dimSizes,dimUnlim)</div>
<div><br>
</div>
<div> filevardef(outncdf, "DateTime", "integer", getvardims(datetime))</div>
<div> filevarattdef(outncdf, "DateTime", datetime)</div>
<div><br>
</div>
<div> filevardef(outncdf, varname, "float", dimNames)</div>
<div> filevarattdef(outncdf, varname, var)</div>
<div><br>
</div>
<div> filevardef(outncdf, "lat", "float", getvardims(latm2d))</div>
<div> filevarattdef(outncdf, "lat", latm2d)</div>
<div><br>
</div>
<div> filevardef(outncdf, "lon", "float", getvardims(lonm2d))</div>
<div> filevarattdef(outncdf, "lon", lonm2d)</div>
<div><br>
</div>
<div> outncdf->DateTime=(/datetime/)</div>
<div> outncdf->$varname$=(/var/)</div>
<div> outncdf->lat=(/latm2d/)</div>
<div> outncdf->lon=(/lonm2d/)</div>
<div><br>
</div>
<div>else</div>
<div><br>
</div>
<div> outncdf = addfile(_outpath+varname+".nc" ,"w")</div>
<div><br>
</div>
<div> outncdf->time(tcount:) = datetime</div>
<div> ;outncdf->DateTime(time|tcount:)=(/datetime/)</div>
<div> ;outncdf->$varname$(time|tcount:,south_north|:,west_east|:)=(/var/)</div>
<div><br>
</div>
<div> outncdf->DateTime(tcount:)=(/datetime/)</div>
<div> outncdf->$varname$(tcount:,:,:)=(/var/)</div>
<div><br>
</div>
<div>end if</div>
</div>
<div><br>
</div>
</div>
</body>
</html>