Comments (5)
Tracked down the row that was giving me trouble:
(IPdb [3]): dfrow
R_NAME SNNP
R_CODE 7
Z_NAME Derashe Lyiu Wereda
Z_CODE 716
W_NAME Derashe Special
W_CODE 71601
KK_NAME None
KK_CODE 0
Remark None
T_NAME None
T_CODE 0
RK_NAME Onota
RK_CODE 71601010.0
EA_NAME 010-04
UK_NAME None
UK_CODE None
EA_ID None
UK_ID None
EA_CODE 4
W_code_t 071601
KK_cd_T None
RK_Code1 None
FID 4714
id 4715
geometry POLYGON ((37.49745968170024 5.653699819037462,...
Name: 4714, dtype: object
(IPdb [4]): sample_feature(dfrow,
id_column,
df_columns,
data.crs,
data.res,
all_touched,
meta,
frac,
min_frac_area)
*** ValueError: cannot set a frame with no defined index and a scalar
from geowombat.
In sample_feature1 seems like
rasterize` is returning an empty array...
feature_array = features.rasterize([geom],
out_shape=geom_info.shape,
fill=0,
out=None,
transform=geom_info.affine,
all_touched=all_touched,
default_value=1,
dtype='int32')
feature_array
array([[0]], dtype=int32)
That creates an empty geodataframe
fea_df = gpd.GeoDataFrame(data=np.c_[fid_, np.arange(0, n_samples)],
geometry=gpd.points_from_xy(x_coords, y_coords),
crs=crs,
columns=[id_column, 'point'])
fea_df
Empty GeoDataFrame
Columns: [id, point, geometry]
Index: []
So then transferring column data back throws an error:
for col in other_cols:
fea_df.loc[:, col] = df_row[col]
*** ValueError: cannot set a frame with no defined index and a scalar
One possible solution
if not fea_df.empty:
for col in other_cols:
fea_df.loc[:, col] = df_row[col]
else:
pass
Although not sure if you prefer a try except...
from geowombat.
@jgrss I am running into issues with gw.extract again. I think its related to the issue above. Just wondering if we have any thoughts on a solution
from geowombat.
@mmann1123 have you tested this proposed solution?
if not fea_df.empty:
for col in other_cols:
fea_df.loc[:, col] = df_row[col]
else:
pass
I would be happy with this.
from geowombat.
@mmann1123 have you tested this proposed solution?
@jgrss Yes this solves the issue for me. I've tested it in a few different scenarios
from geowombat.
Related Issues (20)
- config issue? HOT 11
- ml install HOT 2
- Ubuntu 22.4 & conda HOT 3
- AttributeError: type object 'threadpool_limits' has no attribute 'wrap' HOT 5
- Newer versions (> 1.2.0) do not work with Intel OpenMP installed HOT 15
- `python setup.py sdist` fails to find metadata HOT 4
- Resample leaves no data blocks into Sentinel2 image HOT 2
- geowombat save functionality not working HOT 15
- typo in mosaic min option HOT 3
- to_raster 'compress' functionality 'FileExistsError:' HOT 4
- Problem installing gewombat from git clone HOT 4
- conda-forge fail HOT 1
- Array clip failure HOT 2
- Masking with reproject HOT 1
- Google SEO HOT 8
- DOCS Index
- conda-forge issues HOT 13
- angles tests HOT 2
- conda optional extras HOT 13
- Ml no data HOT 2
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 geowombat.