amuse icon indicating copy to clipboard operation
amuse copied to clipboard

Add warning/error when indexing grids wrongly

Open fjansson opened this issue 6 years ago • 2 comments

When using the grid interface to set variables of an AMUSE/OMUSE code, one can easily make the mistake to put the indexing brackets in the wrong place. Then nothing is actually written, even though the operation appears to succeed. Is it possible to catch this an give a warning or error message?

dales.grid.THL[:,:,5] = 280 | units.K # wrong
dales.grid[:,:,5].THL = 280 | units.K # right

fjansson avatar Jul 31 '19 10:07 fjansson

I think there is unused code to address this in datamodel/base.py, specifically AbstractAttributeValue..though this needs a lot of work still...

ipelupessy avatar Jul 31 '19 10:07 ipelupessy

note this is related to #45 (ie for in-memory sets there is no difference in result for the two above patterns)

ipelupessy avatar Jul 31 '19 10:07 ipelupessy