NCPP / ocgis

OpenClimateGIS is a set of geoprocessing and calculation tools for CF-compliant climate datasets.
Other
70 stars 21 forks source link

shapely::geos.py issue #524

Open msl3v opened 2 years ago

msl3v commented 2 years ago

Dear OCGIS,

Thank you for this tool. It seems it's been some time since any updates have been made. I've been trying several ways to get it to work in my current linux environment. So far, I haven't found any that work. The simplest version of an error I can reliably reproduce is a type error when trying to access *geom.has_z. The error occurs in shapely::geos.py

I've tried with several versions of Python (2.7, 3.6). I'm currently working through shapely versions. I say 'simplest' error, above, since other errors seem to be deeper in the system and don't appear to be resolvable within ocgis.

Any recommendations? I'm not quite able to trace what the code is trying to do.

Thank you.

Dataset: https://gdex.ucar.edu/dataset/camels/file/basin_set_full_res.zip

Commands & error: import ocgis rd = ocgis.RequestDataset('./HCDN_nhru_final_671.shp', driver=DriverKey.VECTOR) field = rd.get() field.geom.has_z Traceback (most recent call last): File "", line 1, in File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/variable/geom.py", line 294, in has_z ret = self.get_masked_value().compressed()[0].has_z File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/variable/base.py", line 942, in get_masked_value ret = np.ma.array(self.get_value(), mask=self.get_mask(), dtype=dtype, fill_value=self.fill_value) File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/variable/base.py", line 1311, in get_value self._value = self._getvalue() File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/variable/base.py", line 1693, in _getvalue self._request_dataset.driver.init_variable_value(self) File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/driver/vector.py", line 35, in init_variable_value value = self.get_variable_value(variable) File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/driver/vector.py", line 135, in get_variable_value for idx, row in enumerate(g): File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/spatial/geom_cabinet.py", line 348, in iter for row in self.sc.iter_geoms(key=self.key, select_uid=self.select_uid, path=self.path, File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/ocgis/spatial/geom_cabinet.py", line 157, in iter_geoms yld = {'geom': wkb.loads(feature.geometry().ExportToWkb())} File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/shapely/wkb.py", line 23, in loads return reader.read(data) File "/home/ilcentro/.conda/envs/env1/lib/python3.9/site-packages/shapely/geos.py", line 427, in read self._reader, c_char_p(data), c_size_t(len(data))) TypeError: bytes or integer address expected instead of bytearray instance