thenatureconservancy / gnarly-landscape-utilities

Tools for resistance, habitat, and core area mapping
http://www.circuitscape.org/gnarly-landscape-utilities
12 stars 5 forks source link

openpyxl cannot read modern xls files #8

Open alvaropp opened 3 years ago

alvaropp commented 3 years ago

I'm finding that the very old version of openpyxl shipped with this tool is not able to read excel files created with a modern version of Excel. Basically, it complains about an unrecognised schema (I cannot access the error itself right now).

My work around has been to get rid of Excel files altogether and used plain .csv files instead. The patched code is in my fork: https://github.com/alvaropp/gnarly-landscape-utilities. Happy to take this further if there's interest, and hope this is useful to future users.

Many thanks for developing Gnarly and Circuitscape!

mtf5319 commented 2 years ago

Hi alvaropp, I'm new to circuitscape and I'm trying to get the demo to work for ArcMap using the core Mapper. When following your link it looks like the core mapper in ArcMap cannot read the .csv file. How did you change the tool for ArcMap? or were you using Julia? Thanks, -Matt

alvaropp commented 2 years ago

Hi Matt, I only worked on this for a couple of hours one year ago—helped a colleague—so don't remember much.

I think we used ArcMap. Basically we modified ArcMap's Python plugin so that it read the config from a csv file, rather than an Excel file. Try installing my plugin instead of the official one: https://github.com/alvaropp/gnarly-landscape-utilities.

The code is simple and the few changes I made are in these lines: https://github.com/alvaropp/gnarly-landscape-utilities/blob/master/Gnarly_Landscape_Utilities/Toolbox/scripts/CoreMapper.py#L59-L73

Good luck!

mtf5319 commented 2 years ago

Thanks, Alvaropp I'll take a look at this.

mtf5319 commented 2 years ago

Hey Alvaropp, After using your code it looks like ArcMap still has a problem reading a .csv file. I'm not sure how to edit the code to allow the tool in ArcMap to read .csv. Do you remember how you achieved this? image

mtf5319 commented 2 years ago

Actually figired it out. Needed to edit the properties within ArcMap for it to read .csv files. And had to edit one line of code slightly. Thanks!