Comments (12)
@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.
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.
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.
@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.
just update the developer docs
Nevermind, we have that covered already
from pydap.
@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.
@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.
OK, I'll go ahead and close then. Glad we got it figured out! :)
from pydap.
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.
@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.
@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.
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)
- Include verify=self.verify within add_dap4_proxies() and add_dap2_proxies() HOT 3
- Solve pkg_resources DeprecationWarning HOT 1
- rename `master` branch to `main`
- TypeError: cannot pickle '_thread.lock' object on OSX (and potentially Win32) for python > 3.8
- update readme + documentation HOT 1
- Modernize pydap for newer python practices HOT 1
- Diagnose xarray-with-pydap errors described below HOT 5
- Extend PyDAP to support EDL tokens HOT 1
- Support for DAP4 objects in PyDAP python library HOT 4
- HTTPError 401 when using pydap + EDL tokens to access EarthData. HOT 1
- remove six dependency HOT 1
- add project.toml file HOT 1
- URL escaping: Does PyDAP escape characters in URLs?
- improve debuging with pre-commit
- run pre-commit on PRs and have auto updates HOT 3
- DAP2 constraint expressions on sequences not fully working properly HOT 1
- DAP4 constraint expressions on sequences not fully working properly
- Allow server side functions as a constraint expressions HOT 2
- Resolve Deprecation Warnings
- KeyError: `nv` when opening remote dataset on DAP4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pydap.