cormorack / yodapy

Your Ocean Data Access in Python
https://cormorack.github.io/yodapy/
MIT License
9 stars 10 forks source link

OOI object does not have a .filter() attribute #57

Closed robfatland closed 6 years ago

robfatland commented 6 years ago

cell 5 in the notebook 'asset = ...' produced

AttributeError: 'OOI' object has no attribute 'filter'

robfatland commented 6 years ago

Persevering: The subsequent code with 'asset = ' will obviously not follow since there is no 'filter'; so I tried to continue just using 'ooi' in place of 'asset' as shown in the code block below. This unfortunately terminates with the message 'Too many instruments to request data for! Max is 5, you have 1314'. So I'm not sure how to reformat my req_asset line so that the kwargs are correct... I have a suspicion they are wrong. Didn't want to create a separate issue here but maybe these are indeed separate. How does one interrogate an object to determine the right way to kwarg one's way to some good data?

# This example is designed to showcase basic data download
# over the time period Nov-2016 through Oct-2017

stdt = '2016-11-01'
enddt = '2017-10-31'

req_asset = ooi.request_data(
    region='cabled', site='oregon slope base shallow profiler', instrument='CTD',
    begin_date=stdt,
    end_date=enddt
)
lsetiawan commented 6 years ago

I just updated the documentation. Please see the updates. Thanks.

robfatland commented 6 years ago

Ok, great. Alas I am still running aground. The req_asset = ... code produces (in ref to enddt) a url.startswith type error:

TypeError: startswith first arg must be str or a tuple of str, not NoneType

The complete message is given below.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-40-11cfd4b32540> in <module>()
      5 
      6 
----> 7 req_asset = ooi.request_data(begin_date='2017-08-20', end_date='2017-08-23')

/opt/conda/lib/python3.6/site-packages/yodapy/datasources/ooi/__init__.py in request_data(self, begin_date, end_date, data_type, limit, stream, **kwargs)
    276             self._logger.error(text)
    277             raise Exception(text)
--> 278         instrument_avail = self._retrieve_availibility(self._filtered_instruments)
    279         do_filter = instrument_avail.items()
    280         if stream:

/opt/conda/lib/python3.6/site-packages/yodapy/datasources/ooi/__init__.py in _retrieve_availibility(self, inst, stream_type)
    163         all_streams = {}
    164         for i, v in inst.iterrows():
--> 165             st = self._client.fetch_instrument_streams(v.reference_designator)
    166             if stream_type != 'all':
    167                 st = list(filter(lambda s: self._client.fetch_stream_metadata(s['stream'])['stream_type']['value'] == stream_type, st))  # noqa

/opt/conda/lib/python3.6/site-packages/yodapy/datasources/ooi/m2m_client.py in fetch_instrument_streams(self, ref_des)
    264 
    265         # Send the request
--> 266         self.send_request(request_url)
    267 
    268         if self._status_code == HTTP_STATUS_OK:

/opt/conda/lib/python3.6/site-packages/yodapy/datasources/ooi/m2m_client.py in send_request(self, url)
    480                     self.m2m_base_url))
    481             return
--> 482         elif not url.startswith(self.base_url):
    483             self._logger.error(
    484                 'URL does not point to the base url ({:s})'.format(

TypeError: startswith first arg must be str or a tuple of str, not NoneType
robfatland commented 6 years ago

Don should I open a new issue or keep this one going?

lsetiawan commented 6 years ago

Please open a new issue... Not sure what is going on.

lsetiawan commented 6 years ago

Thanks!

lsetiawan commented 6 years ago

Are you using the jupyterhub instance?

lsetiawan commented 6 years ago

Also what version of yodapy is it using?

robfatland commented 6 years ago

I am using Port Cormorack; yodapy as recently installed by AT; copying her; and I will open a new issue. tx

On Wed, Aug 1, 2018 at 11:17 AM, Landung Setiawan notifications@github.com wrote:

Also what version of yodapy is it using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cormorack/yodapy/issues/57#issuecomment-409671651, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6Y2XqxbSP5UhN6cHx8ReGyrqMZodHLks5uMfC9gaJpZM4Vpjmg .

-- (((-- very limited email July 19 - Aug 6 --)))

Rob Fatland UW Director Cloud Data Solutions

robfatland commented 6 years ago

ok += new issue.

On Wed, Aug 1, 2018 at 11:20 AM, Rob Fatland rob5@uw.edu wrote:

I am using Port Cormorack; yodapy as recently installed by AT; copying her; and I will open a new issue. tx

On Wed, Aug 1, 2018 at 11:17 AM, Landung Setiawan < notifications@github.com> wrote:

Also what version of yodapy is it using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cormorack/yodapy/issues/57#issuecomment-409671651, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6Y2XqxbSP5UhN6cHx8ReGyrqMZodHLks5uMfC9gaJpZM4Vpjmg .

-- (((-- very limited email July 19 - Aug 6 --)))

Rob Fatland UW Director Cloud Data Solutions

-- (((-- very limited email July 19 - Aug 6 --)))

Rob Fatland UW Director Cloud Data Solutions

lsetiawan commented 6 years ago

Non issue, filter() has been deprecated.