NaN values in a raster create errors with mean()

48 views
Skip to first unread message

Etienne DELAY

unread,
Sep 20, 2017, 10:10:59 AM9/20/17
to GAMA

Hi,
I load a tiff during my initialisation. This raster contains some NaN value ...

1. is it problematic if I try to calculate the average of my grid ? (I assume Yes but how know. :-) )
2. Is there a way to remove NaN value and calculate my average ?

Thank you

E.



Patrick Taillandier

unread,
Sep 20, 2017, 10:12:57 AM9/20/17
to gama-p...@googlegroups.com
Hi,

Can you share the code (and if possible the data) to test it?

Cheers,

Patrick

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Etienne DELAY

unread,
Sep 20, 2017, 10:31:02 AM9/20/17
to GAMA

Yes, :-) of course ! Here my code (peul_move.gaml!
So it's not a common issues?

E.



Le mercredi 20 septembre 2017 16:12:57 UTC+2, Patrick Taillandier a écrit :
Hi,

Can you share the code (and if possible the data) to test it?

Cheers,

Patrick
2017-09-20 16:10 GMT+02:00 Etienne DELAY <abce...@gmail.com>:

Hi,
I load a tiff during my initialisation. This raster contains some NaN value ...

1. is it problematic if I try to calculate the average of my grid ? (I assume Yes but how know. :-) )
2. Is there a way to remove NaN value and calculate my average ?

Thank you

E.



--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
Resource_ferlo.zip

Patrick Taillandier

unread,
Sep 20, 2017, 10:56:55 AM9/20/17
to gama-p...@googlegroups.com
Hi,

So it's not a common issues?
Not, but it is quite common to have grid with "holes".

My solution is to work only with the subset of cells that have a not "NaN" value (I called the variable : active_cells) : active_cells <- cells where (string(each.ndvi) != "NaN");
Please find attached the corrected version of the model. Some remarks:
  • do not use "let" to define a local variable (old way of defining local variables), but rather use the type of variable
  • to display a grid in a normal way (cell with a given color), you should use a "grid" layer than a species layer: far more optimized - the grid layer used the color built-in variable to draw each cell with the right color.
  • try to remove all the warnings
Cheers,

Patrick


To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.
peul_move_pt.gaml

Etienne DELAY

unread,
Sep 20, 2017, 11:13:09 AM9/20/17
to GAMA

Great !
You notice my old fashion netlogo habit :-)

E.

Reply all
Reply to author
Forward
0 new messages