Skip to content

Commit

Permalink
Merge pull request nansencenter#538 from an-ivanov/b2
Browse files Browse the repository at this point in the history
Update vrt.py to fix python optimization
  • Loading branch information
aperrin66 authored Apr 12, 2024
2 parents 6073cad + a302ed5 commit 45bcb77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nansat/vrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,10 @@ def _make_source_bands_xml(src_in):

# find DataType of source (if not given in src)
if src['SourceBand'] > 0 and 'DataType' not in src:
raster_band = gdal.Open(src['SourceFilename']).GetRasterBand(src['SourceBand'])
# prevent Python from releasing the dataset's handle
# prematurely
ds = gdal.Open(src['SourceFilename'])
raster_band = ds.GetRasterBand(src['SourceBand'])
src['DataType'] = raster_band.DataType

if 'xSize' not in src or 'ySize' not in src:
Expand Down

0 comments on commit 45bcb77

Please sign in to comment.