GeoscienceAustralia / PyRate

A Python tool for estimating velocity and time-series from Interferometric Synthetic Aperture Radar (InSAR) data.
https://geoscienceaustralia.github.io/PyRate/
Apache License 2.0
200 stars 70 forks source link

Prepifg opens too many files #323

Closed richardt94 closed 3 years ago

richardt94 commented 3 years ago

Describe the bug The function get_analysis_extent in prepifg_helper.py iterates through a (sometimes very long) list of files and opens them all with GDAL through the open method of the RasterBase class. This sometimes results in conflict with the system's limit on the number of open files and results in a runtime error.

To Reproduce Steps to reproduce the behavior:

  1. Go to /g/data/dg9/INSAR_ANALYSIS/SURAT_S1_Asc/S1/PYRATE/ on VDI.
  2. Run pyrate prepifg using the config file in that folder.

Expected behavior The get_analysis_extent functionality doesn't require all of the raster files to be open at the same time, so it should not be restricted by the system's limit on open file handles.

Notes This can be resolved if we move file opening into the inner loop of _get_same_bounds (currently a list comprehension which is getting the geotransform of each object), and closing the dataset after we are done. I'm not sure if there are other instances in the PyRate workflow where all of the interferograms are opened at the same time, but if so these should be corrected in a similar fashion, and we should move to a more 'on-demand' file handling model to avoid this type of issue in the future.

richardt94 commented 3 years ago

Resolved by #336