Skip to content
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

4 cell neighborhood rule #13

Closed
jennykri opened this issue Mar 19, 2021 · 2 comments
Closed

4 cell neighborhood rule #13

jennykri opened this issue Mar 19, 2021 · 2 comments

Comments

@jennykri
Copy link

4 cell neighborhood rule

You did really great work on the pylandstats toolbox. Thank you for sharing it!

I have noticed that e.g. the number_of_patches function uses a 8 cell neighborhood rule, and probably the other functions do so too. In Fragstats you can chose between 4- and 8- cell rule.
Did you implement the 4 cell neighborhood aswell?

Best regards

@martibosch
Copy link
Owner

Hello @jennykri,

thank you for your suggestion and sorry for the delay in my repsonse. I have added such a functionality in fe4005a and it will be included in the next release, hopefully next week.

Given the way in which pylandstats works, the neighborhood rule is passed to the initialization of Landscape, e.g.:

ls = pls.Landscape('path/to/raster.tif', neighborhood_rule='8')   # default
# or
ls = pls.Landscape('path/to/raster.tif', neighborhood_rule='4')

and then all the metrics computed for this landscape instance (i.e., ls) will be based on such a neighborhood rule. Therefore, if you want to compute some metrics based on the 8-cell neighborhood rule and others based on 4-cell you will need to create two different Landscape instances.

I hope that this addresses the issue, I will let you know when the feature is released. In the meantime, you can install the development version of pylandstats following this instructions - just note that you will net to run git checkout develop before pip install -e . so that you install pylandstats from the source of the develop branch.

@martibosch
Copy link
Owner

I have just released v2.3.0 which includes the neighborhood_rule argument when instantiating Landscape, as well as when instantiating SpatiotemporalAnalysis, ZonalAnalysis, BufferAnalysis, ZonalGridAnalysis and SpatiotemporalBufferAnalysis. I hope that this works for you.

I am closing this but feel free to reopen if needed. Thank you again for your suggestion. Best,
Martí

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants