You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the usage of filterer.values = utils.null_as_zero(filterer), recipe results are changed in a way that NaN values are converted to zero values if they are used in a subsequent filter operation.
Reproducible example
importjsonimportgeopandasasgpdimportsemantiqueassqfromsemantique.processor.coreimportQueryProcessor# define reciperecipe=sq.QueryRecipe()
recipe["res_a"] =sq.reflectance("s2_band02").\
filter_time("before", sq.time_instant("2019-12-31"))
recipe["res_b"] =sq.reflectance("s2_band02").\
filter_time("before", sq.time_instant("2019-12-31"))
recipe["res_c"] =sq.reflectance("s2_band02").\
filter(sq.result("res_a"))
# create contextwithopen("files/mapping.json", "r") asfile:
mapping=sq.mapping.Semantique(json.load(file))
withopen("files/layout_gtiff.json", "r") asfile:
dc=sq.datacube.GeotiffArchive(json.load(file), src="files/layers_gtiff.zip")
space=sq.SpatialExtent(gpd.read_file("files/footprint.geojson"))
time=sq.TemporalExtent("2019-01-01", "2020-12-31")
context= {
"datacube": dc,
"mapping": mapping,
"space": space,
"time": time,
"crs": 3035,
"tz": "UTC",
"spatial_resolution": [-10, 10],
"track_types": False
}
# execute recipefp=QueryProcessor.parse(recipe, **context)
response=fp.optimize().execute()
# evaluate equivalance of both results -> leads to False# res_a contains zero values at places where res_b contains NaN values response["res_a"].equals(response["res_b"])
Expected behavior / Proposed solution
The filter operation should not alter previous results. A deep copy of the filterer needs to be created to ensure this. All occurrences of utils.null_as_zero() within semantique (find . -type f -exec grep -i 'null_as_zero' {} +) should be checked for if they incorrectly mutate an existing object instead of creating a new copy.
The text was updated successfully, but these errors were encountered:
Description
Due to the usage of
filterer.values = utils.null_as_zero(filterer)
, recipe results are changed in a way that NaN values are converted to zero values if they are used in a subsequent filter operation.Reproducible example
Expected behavior / Proposed solution
The filter operation should not alter previous results. A deep copy of the filterer needs to be created to ensure this. All occurrences of
utils.null_as_zero()
within semantique (find . -type f -exec grep -i 'null_as_zero' {} +
) should be checked for if they incorrectly mutate an existing object instead of creating a new copy.The text was updated successfully, but these errors were encountered: