pysal / pointpats

Planar Point Pattern Analysis in PySAL
https://pysal.org/pointpats/
BSD 3-Clause "New" or "Revised" License
80 stars 26 forks source link

How to calculate areas of grid in Quadrat Statistics? #103

Closed hafez-ahmad closed 1 year ago

hafez-ahmad commented 1 year ago

Thank you for developing this excellent package. I have a question regarding the generation of a 3x3 grid based on decimal degree latitude and longitude. Is there a method available to calculate the area of each grid cell? q_r = qs.QStatistic(pp_juv,shape= "rectangle",nx = 3, ny = 3)

Thanks

weikang9009 commented 1 year ago

Yes. Once you have created an instance ofQStatistic with your data

import pointpats.quadrat_statistics as qs
from pointpats import PointPattern
pp = PointPattern(data)
q_r = qs.QStatistic(pp,shape= "rectangle",nx = 3, ny = 3)

you can use the following code to calculate the area of each grid cell:

q_r.mr.rectangle_width * q_r.mr.rectangle_height