If I'm processing a lot of rasters, so far I've been creating files. Which I like doing in the sense it gives me confirmation that the intermediary steps are working correctly. However, after I'm done confirming, this seems inefficient.
I want to attempt to pass the references to the object rather than writing to file. Namely, some of these concepts confuse me:
If I have a list where I append a number of references to gdal raster datasets. I am then holding all of that in my memory. Does that mean 200 mb of rasters would be equivalent to 200 mb of space in my RAM?
You set gdal datasets to none after finishing with them in order to close them. When you are holding references to datasets in a list, and transferring them to another function, do you then set the list to None? Do you have to loop through the list at some point to set the dataset reference to None?
list_of_datasets = []
for file in files:
raster_data = gdal.Open(file)
cut_data = gdal.Translate("", raster_data, format="MEM", projWin=[minx,maxy,maxx,miny], outputSRS=out_srs)
list_of_datasets.append(cut_data)
another_function(list_of_datasets)