Describe the bug
with GAMA 1.9.3, I load an asc / tif file as a grid_file object.
I would be interested to get its contents values, as a matrix of float for example.
I tried:
global {
//definiton of the file to import
grid_file grid_data <- grid_file('../includes/hab10.asc') ;
//computation of the environment size from the geotiff file
geometry shape <- envelope(grid_data);
reflex v {
write grid_data.contents;
write grid_data as matrix;
write (grid_data as field) as matrix;
}
}
What I get:
write grid_data.contents;. --> nil
write grid_data as matrix; --> I get an Exception
write (grid_data as field) as matrix; --> I get the expected result
The exception I get:
1 occurence in Simulation 0 at cycle 0: Java error: nil value detected
in Simulation 0
in write matrix<geometry>(grid_data) ;
NullPointerException: Cannot invoke "msi.gama.util.IAddressableContainer.matrixValue(msi.gama.runtime.IScope, msi.gaml.types.IType, msi.gama.metamodel.shape.GamaPoint, boolean)" because the return value of "msi.gama.util.file.GamaFile.getBuffer()" is null
msi.gama.util.file.GamaFile._matrixValue(GamaFile.java:565)
msi.gama.util.file.GamaFile.matrixValue(GamaFile.java:544)
msi.gama.util.file.GamaFile.matrixValue(GamaFile.java:538)
msi.gaml.types.GamaMatrixType.staticCast(GamaMatrixType.java:71)
msi.gaml.types.GamaMatrixType.cast(GamaMatrixType.java:85)
msi.gaml.types.GamaMatrixType.cast(GamaMatrixType.java:1)
msi.gaml.types.ParametricType.cast(ParametricType.java:160)
when applying the as operator on file('/Applications/Gama1.9.3.app/Contents/Eclipse/configuration/org.eclipse.osgi/21/0/.cp/models/Data/Data Importation/includes/hab10.asc') and matrix<geometry>
in write matrix<geometry>(grid_data) ;
in reflex v {
write grid_data.contents ;
write matrix<geometry>(grid_data) ;
write matrix<float>(field(grid_data)) ;
}
in agent Simulation 0
To Reproduce
Steps to reproduce the behavior:
Example in the Data Importaion model librayr.
Expected behavior
to get something in grid_data.contents
having a matrix of float either in grid_data.contents as matrix or `grid_data.contents as matrix<float>
Desktop (please complete the following information):
Describe the bug with GAMA 1.9.3, I load an asc / tif file as a grid_file object. I would be interested to get its contents values, as a matrix of float for example. I tried:
What I get:
write grid_data.contents;
. --> nilwrite grid_data as matrix;
--> I get an Exceptionwrite (grid_data as field) as matrix;
--> I get the expected resultThe exception I get:
To Reproduce Steps to reproduce the behavior:
Expected behavior
grid_data.contents
grid_data.contents as matrix
or`grid_data.contents as matrix<float>
Desktop (please complete the following information):