-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too hard to create a raster with a run-time data type #483
Comments
i guess that depends how you use it. I usually want to read data with the type of the dataset and when creating a dataset i want that to have the type of the data. In both cases it is nice to use the same generic T for rasterio and driver/band creation. |
I find this super frustrating also. As a point of comparison, I have this sort of thing all over my code: match &raster.cell_type {
CellType::UInt8 => write_dataset(&raster.data.cast_as::<u8>(), &raster.mask, self),
CellType::UInt16 => write_dataset(&raster.data.cast_as::<u16>(), &raster.mask, self),
CellType::UInt32 => write_dataset(&raster.data.cast_as::<u32>(), &raster.mask, self),
CellType::Int16 => write_dataset(&raster.data.cast_as::<i16>(), &raster.mask, self),
CellType::Int32 => write_dataset(&raster.data.cast_as::<i32>(), &raster.mask, self),
CellType::Float32 => write_dataset(&raster.data.cast_as::<f32>(), &raster.mask, self),
CellType::Float64 => write_dataset(&raster.data.cast_as::<f64>(), &raster.mask, self),
} As an antidote, i've been working on a side project called |
I just realized it's Time for a |
ooof 🤢 |
Driver::create_with_band_type_with_options
takes the type as a generic parameter, which is pretty annoying.The text was updated successfully, but these errors were encountered: