openeemeter / eeweather

Fetch NCDC ISD, TMY3, or CZ2010 weather data that corresponds to ZIP Code Tabulation Areas or Latitude/Longitude.
http://eeweather.openee.io/
Apache License 2.0
50 stars 19 forks source link

AttributeError: module 'eeweather' has no attribute 'match_zcta' #16

Closed jakesherman closed 6 years ago

jakesherman commented 6 years ago

Good morning,

I tried using the match_zcta function in eeweather (I'm using Python 3.6.5):

import eeweather
print(eeweather.__version__)
zcta = '70001'
result = eeweather.match_zcta('70001')
result

Which resulted in:

0.2.1
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-857f81446776> in <module>()
      2 print(eeweather.__version__)
      3 zcta = '70001'
----> 4 result = eeweather.match_zcta('70001')
      5 result

AttributeError: module 'eeweather' has no attribute 'match_zcta'

It looks like the match_zcta function, while referenced in the documentation, doesn't actually exist in the package/the master branch. I'm wondering if match_zcta exists in another branch, and maybe hasn't been merged into master yet?

philngo commented 6 years ago

Recently removed this function and @ssuffian is taking a look at updating the docs. What you should do instead now is first get the lat/long coordinates for the centroid of the ZCTA of interest (eeweather.zcta_to_lat_long), then use the eeweather.match_lat_long function directly.

Note: you will need pyproj and shapely installed for this to work.

jakesherman commented 6 years ago

@philngo Awesome, that's exactly the workaround that I was doing! Thank you.

zcta = '70001'
result = eeweather.match_lat_long(*eeweather.zcta_to_lat_long(zcta))
result
philngo commented 6 years ago

Released version 0.2.2 which updates the docs and adds requests, pyproj, and shapely to the required packages.