Non-propagation of attribute values in ncap2

  • Christopher Lynnes

    With ncap2 4.3.1, I find that:
    ncap2 -s 'x *= 3.;'
    drops all of the variable attributes in the output file (except _FillValue),
    ncap2 -s 'x = x * 3.;'
    carries them through.

    Is the attribute dropping a bug or is there a logic behind this distinction?

    Dr. Christopher Lynnes NASA/GSFC, Code 610.2 phone: 301-614-5185
    "The future is already here--it's just not very evenly distributed." Wm. Gibson

  • Charlie Zender

    Charlie Zender - 2014-05-16

    Thanks for pointing this out, Chris.
    The behavior you posted for ncap2 -s 'x = 3.;' is incorrect.
    It appears to be a case where attribute inheritance from the input file is over-ridden by attribute propagation from the RHS (which has no attributes).
    ncap2 -s 'x = x * 3.;' works as intended, presumably because now the propagation mechanism sees the x on the RHS. My guess is that the attribute inheritance
    for all unary operators (+=,
    =, /=, ...) is similarly wrong. It's just something we never noticed before.

    Henry, is this something you're willing and able to fix?


  • henry Butowsky

    henry Butowsky - 2014-05-17

    hi Chris and Charlie -
    Am aware of this .
    So what you saying is that all lValues should get inherited attributes.
    Ill have a look at the code and see if this is feasible

  • Charlie Zender

    Charlie Zender - 2014-05-17

    More precisely, lvalues that are in the input file should
    inherit their attributes from the input file. lvalues that are not in the
    input file should get their attributes from the RHS via attribute propagation.
    I think that is the most intuitive from the user's perspective.
    Basically "x=3' and 'x=x3' should yield the same results.
    i.e., if the variable already has attributes, keep them.

  • henry Butowsky

    henry Butowsky - 2014-05-18

    There is a situation where a user redefines a a variable in input ?

  • henry Butowsky

    henry Butowsky - 2014-05-18

    sorry :
    redines a var in output

  • Charlie Zender

    Charlie Zender - 2014-05-18

    Sorry, I think the sourceforge formatting destroyed my syntax because it contained asterisks, apparently if i indent it then the reformatting goes away. so the line from my previous message should read

    Basically 'x*=3' and 'x=x*3' should yield the same results.

    is it clear now what behavior we want ncap2 to produce?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks