# include "absphot.h"

SkyList *find_regions (FITS_DB *db, SkyRegion *region) {

  Image     *image, *subset;
  int        Nimage, Nsubset, Nchar;
  int       *LineNumber;

  SkyTable *sky = NULL;
  SkyList *skylist = NULL;

  // load the current sky table (layout of all SkyRegions) 
  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);
  SkyTableSetFilenames (sky, CATDIR, "cpt");
  
  // determine the populated SkyRegions overlapping the requested area
  skylist = SkyListByPatch (sky, -1, region);

  return (skylist);
}
