ozak / georasters

GeoRasters is a Python module that provides a fast and flexible tool to work with GIS raster files.
GNU General Public License v3.0
197 stars 37 forks source link

Spatial Autocorrelation measures #13

Open ozak opened 7 years ago

ozak commented 7 years ago

Generalize #11 and address pysal/pysal/issues/895

ozak commented 7 years ago

ozak/georasters@d6b1169 adds Global spatial autocorrelation measures to GeoRasters

ozak commented 7 years ago

ozak/georasters@e76a24e Added local spatial autocorrelation measures. Output is similar to Pysal, but is saved in a GeoRaster, so that the geographical information of the original data is preserved and output is aligned to underlying data.

ozak commented 7 years ago

@sjsrey I have uploaded a script that shows the use of the Spatial autocorrelation measures spatial_script.py

In order to test the functionality and ensure it is correct it would be good to use a known data set with results (in order to compare). Do you have one in mind?

sjsrey commented 7 years ago

I''ve hit another bug trying to install on a different linux machine. In a new conda environment the instructions for pip install georasters will generate many errors (gdal problems mostly). I tried to get around them with first installing gdal via:

conda install gdal

and then the pip install georasters works.

However when trying to import georasters I then get the following error:

In [1]: import georasters as gr
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-9d3425e47620> in <module>()
----> 1 import georasters as gr

/home/serge/anaconda2/envs/georasters/lib/python2.7/site-packages/georasters/__init__.py in <module>()
      1 # This file allows all subdirectories in this directory to be loaded by Python
      2 # -*- coding: utf-8 -*-
----> 3 from .georasters import get_geo_info, map_pixel, map_pixel_inv, aggregate, create_geotiff, align_rasters, \
      4                         load_tiff, union, GeoRaster, RasterGeoError, RasterGeoTError, RasterGeoTWarning, merge, \
      5                         from_file, to_pandas, to_geopandas, from_pandas, raster_weights, map_vector

/home/serge/anaconda2/envs/georasters/lib/python2.7/site-packages/georasters/georasters.py in <module>()
     36 import matplotlib.pyplot as plt
     37 import pandas as pd
---> 38 from fiona.crs import from_string
     39 import geopandas as gp
     40 from shapely.geometry import Polygon, LineString

ImportError: No module named fiona.crs
ozak commented 7 years ago

That is strange, since it is able to install on Travis, which is Linux and uses conda. What version of fiona do you have? I just installed on a clean install of OS X 10.12 with fiona-1.5.1 and on my machine I have fiona-1.7.0.post2.

ozak commented 7 years ago

The GDAL issues may be due to conda having an issue with GDAL 2 vs GDAL 1. I've seen conda complain in other packages I used or installed. See,s parts of the conda packages are compiled against v1 and others against v2, and conda does not force it to be the same underlying library. I had to force conda to use GDAL 1, although georasters does not really care about which version is installed (unless they removed functions or changed the way to call them).

sjsrey commented 7 years ago

Can you update the install instructions to show how you are explicitly forcing to use GDAL 1?

ozak commented 7 years ago

I use a YAML file to pass instruction to conda. I just used the condition gdal<2. I guess one could use conda install gdal<2?

sjsrey commented 7 years ago

is it in the repos? it would help other devs get setup to work on the project :->

On Tue, Dec 27, 2016 at 3:54 PM, Ömer Özak notifications@github.com wrote:

I use a YAML file to pass instruction to conda. I just used the condition gdal<2. I guess one could use conda install gdal<2?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ozak/georasters/issues/13#issuecomment-269399789, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHNGn8HHqhxsw_jJyoKjnxF-4HCiwGyks5rMaVAgaJpZM4LTlw0 .

-- Sergio (Serge) Rey Professor of Computational Spatial Science School of Geographical Sciences and Urban Planning Center for Geographical Information Science Arizona State University https://geoplan.asu.edu/sergio-rey

Editor, Geographical Analysis http://wileyonlinelibrary.com/journal/gean

ozak commented 7 years ago

I will add it...I never thought people would have problem, since I did not have issues with Travis. Let me try to use the Travis.yml file to see if that would work better, since I have too many packages installed.

sjsrey commented 7 years ago

Cool. This can help as we use local yml files to get users setup for workshops on PySAL so maybe the same thing could be used for devs on georasters?

Here is an example

ozak commented 7 years ago

I will try to provide an example later tonight. I was trying to upgrade my OS, so not everything is working at the moment.

ozak commented 7 years ago

Ok..looks like I was finally able to get it in a conda env try_georasters2.yml. It seems the move to GDAL 2 has cause d major breaks and not all channels are compatible nor do they have GDAL+OGR+GeoPandas+Fiona (+libs) compatible.

It seems conda does not install all the requirements (nor the requirements of the requirements. Is there a way to force it?

Let me know if it works for you too. And thanks for taking the time!

ozak commented 7 years ago

one more script in case you rather try python-3.5 try_georasters3.yml

ozak commented 7 years ago

I have uploaded it to anaconda.org so perhaps now it will be easier to install.

ozak commented 5 years ago

PySal functions have been added. Need tests and update to new API.