-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid pos/index within RasterLayer (geographic spatial location not exposed to GeoSpace / RasterLayer)? #267
Comments
Hi, thanks for the detailed writeup and sorry about the confusion. The rasterlayer was implemented some time ago and it deserves some improvements. Regarding how it currently works, there are two ways of indexing a cell:
This absolutely makes sense. Unfortunately till now there's no built-in method or attribute to retrieve the physical location of a cell in longitude & latitude. This will not work with the In Mesa-Geo the physical locations are handled by the
I'm guessing this works because the I hope this clarifies! We wish to refactor raster layer in the near future (as mentioned in #201). This is the last one or two things that's blocking a |
@wang-boyu - Thanks so much for the detailed markup! I appreciate it greatly and this clarifies a lot for me. Regarding the specifics task of getting the underlying cells, I addressed it using the technique you suggest:
Where self in this case references the I obviously don't have the specifics for mesa-geo's case, but from my perspective, some primitive linking the Thanks again - since the bug in question is not a bug, I will close. |
Thanks for all your work on this library - I am looking forward to using it for our vegetation modelling efforts!
Describe the bug
The
pos
attribute of a Cell (within aRasterLayer
) does not contain validx, y
coordinate in physical space in my specified CRS. This is despite the fact that theRasterLayer
is displayed in the proper location in physical space via the accompanying Solara Visualization.Expected behavior
Based on the mesa-geo docs of
Cell
, I expect the 'pos' attribute to represent thex, y
location of the cell in physical space, within the CRS specified when theRasterLayer
is instantiated (in my case, from the GeoTIFF created by previous instantiation of theRasterLayer
and exporting via theto_file
method.More generally, I expected some way to query the
RasterLayer
object to grab relevantCell
s based on their location in space. I only noticed this (potential) bug when trying out the various methods for grabbing neighboring cells, and noticing than none of them seemed to use a spatial argument, only indexes of the underlyingRasterLayer
.To Reproduce
There is a devcontainer setup within this repo, which was adopted from
mesa-geo
's rainfall model example. There are a few artifacts of the original rainfall model's behavior here, as I haven't successfully gotten through a complete step of the model yet.I am using the following, on an Ubuntu-based image running Python 3.12.7 :
To run, with
Docker
,VSCode
andExtensions - Dev Containers
installed, one can run:From there, one can run the
solara
app using the provided launch configuration in the VSCode debugger, or run Solara as normal from the terminal (using the already installedmesa
conda environment.Additional context
As alluded to above - I am having some trouble understanding the relationship between the agents (which exist in vector / continuous space) and the underlying cells (which exist in raster / discrete space).
It seems like a very natural need for these modelling approaches to provide an interface between the two (for example, in our vegetation case, the vegetation agents must know something about the aridity of the underlying cells, but the aridity is a feature of the cell, not the agent itself) - which leads me to believe I am misunderstanding something about the design of
mesa
/mesa-geo
in general. Since this seems like such a foundational concept, I am pretty tempted to say this is a misunderstanding of the tools you've built on my part - but, since I am on an alpha release and so much seems to have been updated formesa
3.0+, I figured I would see if this is truly a bug.Thank you again for all your efforts and I am excited to give
mesa
/mesa-geo
a shot for our academic applications!The text was updated successfully, but these errors were encountered: