weecology / mete-geog

Research on making geographic predictions for macroecological patterns using the Maximum Entropy Theory of Ecology
2 stars 3 forks source link

Fix import_data() function in mete_geog.py #1

Closed dmcglinn closed 11 years ago

dmcglinn commented 11 years ago

Line 37 in mete_geog.py is currently commented out:

sad_data = sad_data.ix[np.in1d(sad_data['SiteID'].values, envpred_data['SiteID'].values)]

This line attempts to ensure that the SiteID variable is identical in the observed and predicted data files. This line of code currently fails with the same error message for the cbc and nabc datasets but not for the bbs or fia datsets. For example uncommenting this line of code and running

dataset='cbc'
envpred_data, sad_data = import_data('./data/', dataset)

returns the following errors:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 9, in import_data
File "/usr/lib/python2.7/dist-packages/numpy/lib/arraysetops.py", line 335, in in1d
order = ar.argsort(kind='mergesort')
TypeError: requested sort not available for type

Note that I am running pandas version 0.8.0

ethanwhite commented 11 years ago

Presumably this is due to the (very) outdated version of pandas that you're running. From the command line run:

easy_install pip
pip install --upgrade pandas

and see if that fixes it.

ethanwhite commented 11 years ago

Code returned to original state in f6434c6f56fe42b37b14eb277b8ba261de375732.