Closed qideng7 closed 1 year ago
Thanks for reporting the issue.
However, I cannot reproduce this issue with the latest version, 0.15. Can you update your pynhd
version and try again?
Thanks for reporting the issue.
However, I cannot reproduce this issue with the latest version, 0.15. Can you update your
pynhd
version and try again? Tried with 0.15.0 version pynhd, got the same error.
from pynhd import NLDI
import pynhd
print(pynhd.__version__)
0.15.0
nldi = NLDI()
station_id = "01031500"
basin = nldi.get_basins(station_id)
ProjError Traceback (most recent call last) Cell In[4], line 9 6 nldi = NLDI() 7 station_id = "01031500" ----> 9 basin = nldi.get_basins(station_id)
File ~\anaconda3\envs\flow_Ml\lib\site-packages\pynhd\pynhd.py:900, in NLDI.get_basins(self, feature_ids, fsource, split_catchment, simplified) 898 urls = (("linked-data", fsource, fid, f"basin?{query}") for fid in feature_ids) 899 index, resp = self._get_urls(urls, True) --> 900 basins = geoutils.json2geodf(resp, 4269, 4326) # type: ignore 901 basins.index = pd.Index([feature_ids[i] for i in index], name="identifier") 902 basins = basins[~basins.geometry.isnull()].copy()
File ~\anaconda3\envs\flow_Ml\lib\site-packages\pygeoutils\pygeoutils.py:120, in json2geodf(content, in_crs, crs) 118 geodf = geodf.set_crs(in_crs) 119 if in_crs != crs: --> 120 geodf = geodf.to_crs(crs) 121 geodf = cast("gpd.GeoDataFrame", geodf) 122 return geodf
File ~\anaconda3\envs\flow_Ml\lib\site-packages\geopandas\geodataframe.py:1364, in GeoDataFrame.to_crs(self, crs, epsg, inplace) 1362 else: 1363 df = self.copy() -> 1364 geom = df.geometry.to_crs(crs=crs, epsg=epsg) 1365 df.geometry = geom 1366 if not inplace:
File ~\anaconda3\envs\flow_Ml\lib\site-packages\geopandas\geoseries.py:1124, in GeoSeries.to_crs(self, crs, epsg)
1047 def to_crs(self, crs=None, epsg=None):
1048 """Returns a GeoSeries
with all geometries transformed to a new
1049 coordinate reference system.
1050
(...)
1121
1122 """
1123 return GeoSeries(
-> 1124 self.values.to_crs(crs=crs, epsg=epsg), index=self.index, name=self.name
1125 )
File ~\anaconda3\envs\flow_Ml\lib\site-packages\geopandas\array.py:779, in GeometryArray.to_crs(self, crs, epsg) 775 return self 777 transformer = Transformer.from_crs(self.crs, crs, always_xy=True) --> 779 new_data = vectorized.transform(self.data, transformer.transform) 780 return GeometryArray(new_data, crs=crs)
File ~\anaconda3\envs\flow_Ml\lib\site-packages\geopandas_vectorized.py:1114, in transform(data, func) 1111 result[~has_z] = set_coordinates(data[~has_z].copy(), np.array(new_coords_z).T) 1113 coords_z = get_coordinates(data[has_z], include_z=True) -> 1114 new_coords_z = func(coords_z[:, 0], coords_z[:, 1], coords_z[:, 2]) 1115 result[has_z] = set_coordinates(data[has_z].copy(), np.array(new_coords_z).T) 1117 return result
File ~\anaconda3\envs\flow_Ml\lib\site-packages\pyproj\transformer.py:430, in Transformer.transform(self, xx, yy, zz, tt, radians, errcheck, direction) 428 intime = None 429 # call pj_transform. inx,iny,inz buffers modified in place. --> 430 self._transformer._transform( 431 inx, 432 iny, 433 inz=inz, 434 intime=intime, 435 direction=direction, 436 radians=radians, 437 errcheck=errcheck, 438 ) 439 # if inputs were lists, tuples or floats, convert back. 440 outx = _convertback(xisfloat, xislist, xistuple, inx)
File pyproj/_transformer.pyx:459, in pyproj._transformer._Transformer._transform()
ProjError: x, y, z, and time must be same size
Thanks! My next guess is that there's an issue either with pyproj
or geopandas
versions. First, let's check pyproj
. In my environment that works without issue, pyproj
version is 3.5 and yours is 2.6. Please only update pyproj
and see if it solves the issue.
Feel free to reopen if you still have issue with this.
What happened?
I was playing with the pynhd Quick Start examples but encountered with input error, "x, y, z, and time must be same size". It seems to be caused by crs transform.
What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment