Coder Social home page Coder Social logo

Missing 'proxy' module about pydap HOT 12 CLOSED

pydap avatar pydap commented on June 7, 2024
Missing 'proxy' module

from pydap.

Comments (12)

laliberte avatar laliberte commented on June 7, 2024 1

@giumas I've looked at your code and my opinion is that pydap proxy objects should not be assumed to be part of the public API. The obvious solution would be to rely only on the DatasetType object output from the open_url() function. If the function exits successfully, this object should contain all of the OPeNDAP dataset attributes and properly instantiated data proxy objects.

Moreover, it would seem to me that the easiest fix would be change https://github.com/HDFGroup/hdf-compass/blob/develop/hdf_compass/opendap_model/model.py#L235 to

self._data = new_dset[new_key].data

and line https://github.com/HDFGroup/hdf-compass/blob/develop/hdf_compass/opendap_model/model.py#L214-L215 should probably be removed.

from pydap.

jameshiebert avatar jameshiebert commented on June 7, 2024

AFAICT @robertodealmeida replaced the proxy module during a refactoring in commits bc06451 and 92ed74b. It kind of looks like you can use BaseProxy and SequenceProxy to similar ends...

We should probably decide whether that's actually intended to be a public API, and if so, update the developer docs to reflect it.

from pydap.

giumas avatar giumas commented on June 7, 2024

Thank you for the quick answer! However, from a first look, it seems that there are much more changes that just this class (and its changed named arguments).

For instance, the DatasetType does not more indirectly inherit from odict. Thus, the app fails when it tries to call the missing setdefault method (AttributeError: '<class 'pydap.model.DatasetType'>' object has no attribute 'setdefault').

from pydap.

jameshiebert avatar jameshiebert commented on June 7, 2024

@giumas are you satisfied with @laliberte's suggestions as a resolution to your issue? If so we can close this and just update the developer docs.

from pydap.

jameshiebert avatar jameshiebert commented on June 7, 2024

just update the developer docs

Nevermind, we have that covered already

from pydap.

giumas avatar giumas commented on June 7, 2024

@jameshiebert My apologies for not getting back on this! I am currently working on stuff quite far from HDF Compass.

@jreadey Do you have time to give a look if the proposed solution fits the HDF Compass needs?

from pydap.

jreadey avatar jreadey commented on June 7, 2024

@giumas - it looks fine as far as I can see. What this fix resolve HDFGroup/hdf-compass#186?
If you have time to do the update, that would be great.

from pydap.

jameshiebert avatar jameshiebert commented on June 7, 2024

OK, I'll go ahead and close then. Glad we got it figured out! :)

from pydap.

giumas avatar giumas commented on June 7, 2024

it looks fine as far as I can see

@jreadey Does it mean that you actually tested it? It does not seem that the two proposed changes are enough, at least on Windows.

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 382, in __getattr__
    return self[attr]
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 425, in __getitem__
    return self._getitem_string(key)
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 404, in _getitem_string
    return self._dict[quote(key)]
KeyError: 'setdefault'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 235, in __getattr__
    return self.attributes[attr]
KeyError: 'setdefault'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\code\test\hdf-compass\hdf_compass\compass_viewer\frame.py", line 220, in on_resource_open
    self.open_url(url)
  File "c:\code\test\hdf-compass\hdf_compass\compass_viewer\frame.py", line 225, in open_url
    if can_open_store(url):
  File "c:\code\test\hdf-compass\hdf_compass\compass_viewer\viewer.py", line 175, in can_open_store
    instance = stores[0](url)
  File "c:\code\test\hdf-compass\hdf_compass\opendap_model\model.py", line 68, in __init__
    self._dataset.setdefault('')
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 384, in __getattr__
    return DapType.__getattr__(self, attr)
  File "C:\Users\user\AppData\Local\HyOc\py3\x64\lib\site-packages\pydap\model.py", line 239, in __getattr__
    % (type(self), attr))
AttributeError: '<class 'pydap.model.DatasetType'>' object has no attribute 'setdefault'

But I am not familiar with pydap. Who wrote the pydad plugin for HDF Compass?

from pydap.

jreadey avatar jreadey commented on June 7, 2024

@giumas, no I haven't had a chance to try it out.

We had an intern (3 years ago!) who wrote the PyDap plugin.

from pydap.

ax3l avatar ax3l commented on June 7, 2024

@giumas @laliberte @jameshiebert @jreadey the issue is not solved. Can you please re-open this issue and take a second look?
I tried to debug it and could not solve it either - although I have 0 knowledge on pydap...

from pydap.

ax3l avatar ax3l commented on June 7, 2024

This is the last backend that is missing to ship the py3 branch in hdf-compass for a new release, afaik: HDFGroup/hdf-compass#186

We are talking about

which can be tested as follows when you clone the py3 branch of hdf-compass:

python3 -m unittest hdf_compass.opendap_model.test

Issues are a missing member .setdefault('') which only existed in ArrayProxy and resulting key errors in access to "root" [''].

from pydap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.