Re: Creating rasterio dataset without IO

Brendan Ward


if your goal is to mask the data, you can replicate some of the processing steps in the `mask` chain:

Specifically, you'd need to figure out the transform and output shape for your mask based on your source data and polygon, then it is just a matter of calling geometry_mask with those parameters:

Then apply that mask to your data, which you've already prepared in a prior step.

Having the dataset as a gives us access to many of the properties we need to be able to calculate those parameters.  To create a mask we don't actually need to read data from the dataset, it's only when the mask is applied that we need those data.  This use case seems outside the intent for MemoryFile.

I hope that helps.

Join to automatically receive all group messages.