-
Couldn't load subscription status.
- Fork 82
ENH: add xarray interface to Graph #740
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
Conversation
|
Oh, another note - I think that the tests of this and of W implementation pass only if |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #740 +/- ##
======================================
Coverage 85.2% 85.2%
======================================
Files 145 147 +2
Lines 15662 15784 +122
======================================
+ Hits 13345 13449 +104
- Misses 2317 2335 +18
|
|
After @martinfleis resolves the conflicts, are we OK to merge or should we get one more approval? |
|
@sjsrey @martinfleis @knaaptime I'll merge this at 5:00pm Eastern time (4 hours from the time of this post) unless there are any detractors. |
This attempts to mirror the functionality of the
weights.rastermodule within theGraph. I tried to re-use as much of the code fromweightsas I could which required quite a bit of refactoring there to avoid too many unnecessary conversions back and forth.Contrary to the original implementation, we don't need any new public attribute to facilitate using the graph within esda etc but I have added one private one. If it is not present it is not the end of the world either, you just get
level_0,level_1etc as the dimension names in the DataArray. But I tried to preserve it in most common operations.Compared to the original, there are some minor differences when putting it work. For example, computing LISA would look like this, using the tif from https://data.worldpop.org/GIS/Population/Global_2000_2020/2019/LUX/lux_ppp_2019.tif (which needs to be pulled locally).
It is probably not as fast as the original WSP due to some overhead of Graph but it works.
As a side note, I think that the detection of no data value in the constructor in the
weights.rastermodule needs updating as it only checks forda.attrs["nodatavals"]but the example above usesda.attrs["_FillValue"]. It is generally better to try getting it viada.rio.nodatabut I'll open an issue for that.Another side note - the Raster_Awareness notebook is not executable as it uses files I have no idea where from and some custom branch of
splot.This also includes one line from #739 to ensure this actually works as intended.