<div dir="ltr">Dave,<div><br></div><div>Thanks for your description of the subtleties of _FillValue and the value-only assignment. Please note though that not only is the _FillValue attribute getting added, the variable's pre-existing attributes are getting lost. Do you consider this latter aspect a bug or feature? It is this that I am more concerned about. Also, this removal of the pre-existing attributes happens with NetCDF4 (for ncl version 6.3.0, but not 6.2.1) and not with NetCDF3.</div><div><br></div><div>Keith</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 2, 2015 at 5:13 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Keith,<br>
I think that what you are seeing is actually documented (although<br>
poorly apparently) behavior. At least, if, as I am assuming from your<br>
test script, the only attribute that gets passed through the<br>
value-only assignment is the _FillValue. The NCL Reference Manual says<br>
this about value-only assignment:<br>
<br>
"No dimension names, coordinate variables or attributes other than<br>
_FillValue are assigned. "<br>
<br>
In fact the _FillValue is a special attribute that even values (as<br>
opposed to variables) in NCL carry around. And it is propagated even<br>
through value-only assignment. That is because it is considered an<br>
essential component of the value.<br>
<br>
If in fact you are seeing other attributes get propagated let us know.<br>
Your test script only showed the _FillValue propagation as far as I<br>
could tell.<br>
-dave<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On Mon, Nov 2, 2015 at 9:03 AM, Keith Lindsay <<a href="mailto:klindsay@ucar.edu">klindsay@ucar.edu</a>> wrote:<br>
> Hi,<br>
> Thanks Dennis. For other users that run into this behavior, a workaround to<br>
> avoid it is to ensure that the variable on the rhs of the problematic<br>
> assignment does not have the _FillValue attribute. I.e.<br>
> if (isatt(tmpvar, "_FillValue")) then<br>
> delete(tmpvar@_FillValue)<br>
> end if<br>
> Keith<br>
><br>
><br>
> On Mon, Nov 2, 2015 at 8:44 AM, Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br>
>><br>
>> A JIRA ticket [ NCL-2302 ] has been opened. THX<br>
>><br>
>> On Mon, Nov 2, 2015 at 8:06 AM, Keith Lindsay <<a href="mailto:klindsay@ucar.edu">klindsay@ucar.edu</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > I have come across an instance where I'm writing a variable to a file<br>
>> > and<br>
>> > the variable metadata in the file is getting overwritten, even though<br>
>> > I'm<br>
>> > using (/ ... /) on the right-hand side of the write to file statement.<br>
>> > That<br>
>> > is, the statement<br>
>> > f->$varname$ = (/ tmpvar /)<br>
>> > is overwriting the metadata for the file variable $varname$ in the file<br>
>> > pointed to by f. The attached script demonstrates the problem. This<br>
>> > seems<br>
>> > like an ncl bug to me.<br>
>> ><br>
>> > Details of my script that seem to matter are:<br>
>> > 1) the file is NetCDF4<br>
>> > 2) the file variable whose metadata is getting overwritten has been<br>
>> > defined<br>
>> > in the file but not written to yet<br>
>> > 3) the file variable whose metadata is getting overwritten does not have<br>
>> > the<br>
>> > _FillValue attribute<br>
>> > 4) the variable on rhs of write to file statement has _FillValue<br>
>> > attribute<br>
>> ><br>
>> > The problem happens with ncl 6.3.0 on yellowstone. It does not happen<br>
>> > with<br>
>> > ncl 6.2.1, though with 6.2.1 the _FillValue gets added to the file<br>
>> > variable's metadata, which is unexpected to me.<br>
>> ><br>
>> > Keith<br>
>> ><br>
>> > _______________________________________________<br>
>> > ncl-talk mailing list<br>
>> > <a href="mailto:ncl-talk@ucar.edu">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/mailman/listinfo/ncl-talk</a><br>
>> ><br>
><br>
><br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu">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/mailman/listinfo/ncl-talk</a><br>
><br>
</div></div></blockquote></div><br></div>