Skip to content

is it possible to change dtype to uint16? #98

Answered by snowman2
oswald1234 asked this question in Q&A
Discussion options

You must be logged in to vote

Step 1: Make sure input data values are uint16
Step 2: Make sure the nodata value is compatible with uint16 as the default is numpy.nan
https://corteva.github.io/geocube/stable/geocube.html#make-geocube

roads["train_id"] = roads.train_id.astype(np.uint16)
roads = make_geocube(
    vector_data=roads,
    measurements=['train_id'],
    resolution=(-10,10),
    rasterize_function=partial(rasterize_image,all_touched=True),
    fill=0,
)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by oswald1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants