Store for accessing OpenDAP datasets with pydap. This store provides an alternative way to access OpenDAP datasets that may be useful if the netCDF4 library is not available.
| 74 | |
| 75 | |
| 76 | class PydapDataStore(AbstractDataStore): |
| 77 | """Store for accessing OpenDAP datasets with pydap. |
| 78 | |
| 79 | This store provides an alternative way to access OpenDAP datasets that may |
| 80 | be useful if the netCDF4 library is not available. |
| 81 | """ |
| 82 | |
| 83 | def __init__( |
| 84 | self, |
| 85 | dataset, |
| 86 | group=None, |
| 87 | session=None, |
| 88 | protocol=None, |
| 89 | checksums=True, |
| 90 | ): |
| 91 | """ |
| 92 | Parameters |
| 93 | ---------- |
| 94 | ds : pydap DatasetType |
| 95 | group: str or None (default None) |
| 96 | The group to open. If None, the root group is opened. |
| 97 | """ |
| 98 | self.dataset = dataset |
| 99 | self.group = group |
| 100 | self._protocol = protocol |
| 101 | self._checksums = checksums # true by default |
| 102 | |
| 103 | @classmethod |
| 104 | def open( |
| 105 | cls, |
| 106 | url, |
| 107 | group=None, |
| 108 | application=None, |
| 109 | session=None, |
| 110 | output_grid=None, |
| 111 | timeout=None, |
| 112 | verify=None, |
| 113 | user_charset=None, |
| 114 | checksums=True, |
| 115 | ): |
| 116 | from pydap.client import open_url |
| 117 | from pydap.net import DEFAULT_TIMEOUT |
| 118 | |
| 119 | if output_grid is not None: |
| 120 | # output_grid is no longer passed to pydap.client.open_url |
| 121 | from xarray.core.utils import emit_user_level_warning |
| 122 | |
| 123 | emit_user_level_warning( |
| 124 | "`output_grid` is deprecated and will be removed in a future version" |
| 125 | " of xarray. Will be set to `None`, the new default. ", |
| 126 | FutureWarning, |
| 127 | ) |
| 128 | output_grid = False # new default behavior |
| 129 | |
| 130 | kwargs = { |
| 131 | "url": url, |
| 132 | "application": application, |
| 133 | "session": session, |
no outgoing calls
searching dependent graphs…