############################################################################### # This isisminer CONFIG file determines image overlaps for all MDIS images. # The complete set of MESSENGER MDIS image data is contained in two # separate databases. This set of Strategies reads from two different # databases created from footprintinit/caminfo data and determines the stereo # compliments for every image in the defined Region. Region definitions # should be used to restrict the range of images using database # CenterLatitude/CenterLongitude and the corners of the Region definition in # the GLOBALS file parameter. # # @author 2015-06-05 Kris Becker # ############################################################################### Object = IsisMiner Name = ImageOverlapper RequiredParameters = ("DBDir", "OutputDir", "Region", "RegionLowerLeftLatitude", "RegionUpperRightLatitude", "RegionLowerLeftLongitude", "RegionUpperRightLongitude", "StereoConfig") Object = Strategy # Read in orbital data before and including October 30, 2014 Name = MDISSelectRegionOct2014 Type = DatabaseReader DbFileArgs = "DBDir" DbFile = "%1/Messenger_DOY_2011095_TO_2014304_gis.db" Mode = Select # Select strings that need double quotes must use " since they cannot # be stored in keyword values. These strings will be prescanned before # issuing to the DB driver and they will be properly replaced. Query = "select i.SourceProductId, i.YearDoy, i.File, i.Number, i.Lines, i.Samples, i.FocalPlaneTemperature, i.TempDependentFocalLength, g.StartTime, i.EtStartTime, i.ExposureDuration, g.HasNorthPole, g.HasSouthPole, g.HasLongitudeBoundary, g.CenterLongitude, g.CenterLatitude, g.CenterRadius, i.ObservationType, g.PixelResolution, g.MeanGroundResolution, g.IncidenceAngle, g.EmissionAngle, g.PhaseAngle, g.SubSolarGroundAzimuth, g.SubSpacecraftGroundAzimuth, g.SubSpacecraftLatitude, g.SubSpacecraftLongitude, g.SubSolarLatitude, g.SubSolarLongitude, g.TargetCenterDistance, g.SlantDistance, g.ParallaxX, g.ParallaxY, g.ShadowX, g.ShadowY, p.GisFootprint from Polygon p INNER JOIN Image i ON p.SourceProductId=i.SourceProductId INNER JOIN Geometry g ON p.SourceProductId=g.SourceProductId" # Resource targets are for reading multiple rows from the DB. The fields # from each row are created as Resources. Target = Resource Identity = "%1" IdentityArgs = "SourceProductId" # Can specify a GIS keyword that will be converted on input GisGeometryRef = GisFootprint GisType = WKB # Tolerance of 0.005 is about 213 at the Mercury equator GisSimplifyTolerance = 0.005 GisGeometryPointsKey = GisPoints RemoveGisKeywordAfterImport = True EndObject Object = Strategy # Read in orbital data after October 30, 2014 Name = MDISSelectRegionMay2015 Type = DatabaseReader DbFileArgs = "DBDir" DbFile = "%1/Messenger_DOY_2014305_TO_2015120_gis.db" Mode = Select # Select strings that need double quotes must use " since they cannot # be stored in keyword values. These strings will be prescanned before # issuing to the DB driver and they will be properly replaced. Query = "select i.SourceProductId, i.YearDoy, i.File, i.Number, i.Lines, i.Samples, i.FocalPlaneTemperature, i.TempDependentFocalLength, g.StartTime, i.EtStartTime, i.ExposureDuration, g.HasNorthPole, g.HasSouthPole, g.HasLongitudeBoundary, g.CenterLongitude, g.CenterLatitude, g.CenterRadius, i.ObservationType, g.PixelResolution, g.MeanGroundResolution, g.IncidenceAngle, g.EmissionAngle, g.PhaseAngle, g.SubSolarGroundAzimuth, g.SubSpacecraftGroundAzimuth, g.SubSpacecraftLatitude, g.SubSpacecraftLongitude, g.SubSolarLatitude, g.SubSolarLongitude, g.TargetCenterDistance, g.SlantDistance, g.ParallaxX, g.ParallaxY, g.ShadowX, g.ShadowY, p.GisFootprint from Polygon p INNER JOIN Image i ON p.SourceProductId=i.SourceProductId INNER JOIN Geometry g ON p.SourceProductId=g.SourceProductId" # Resource targets are for reading multiple rows from the DB. The fields # from each row are created as Resources. Target = Resource Identity = "%1" IdentityArgs = "SourceProductId" # Can specify a GIS keyword that will be converted on input GisGeometryRef = GisFootprint GisType = WKB # Tolerance of 0.005 is about 213 at the Mercury equator GisSimplifyTolerance = 0.005 GisGeometryPointsKey = GisPoints RemoveGisKeywordAfterImport = True EndObject Object = Strategy # This algorithm discards images (Resources) where values in the Keyword # value keys cannot be converted to double values. This will find the DB # columns that have a NULL value. This specification will remove all # images that don't have valid geometry at the image center (CenterLatitude, # CenterLongitude). Name = FindBadOnes Type = IsNumeric Description = "Identify images with invalid center pixel geometry" Keyword = ( "CenterLatitude", "CenterLongitude" ) EndObject Object = Strategy # The images identified in the previous Strategy cannot be use in any # stereo computations so prevent their resurrection to help increase # efficiency. Name = DeleteBadOnes Type = ResourceManager Description = "Delete resources with bad values in required keywords" Operations = DeleteDiscard EndObject Object = Strategy # This algorithm will select only MDIS images where the center latitude # and longitudes are within the defined region provided in the GLOBALS # parameter file. Name = SelectRegion Type = Limit Description = "Find all MDIS images with center image geometry in the defined region" # This set of equations will result in 1 if test are good, meaning the # clat/clon is in the defined region. If any test fails, InRegion = 0 # (false) and the Resource is disabled. Note this also defines the GIS # bounding box. Group = Equations InRegion = 1 InRegion = "InRegion * (CenterLongitude > RegionLowerLeftLongitude)" InRegion = "InRegion * (CenterLatitude > RegionLowerLeftLatitude)" InRegion = "InRegion * (CenterLongitude <= RegionUpperRightLongitude)" InRegion = "InRegion * (CenterLatitude <= RegionUpperRightLatitude)" EndGroup EndObject # Ensure the output directory exists for the CSV files Object = Strategy Name = MakeOutputDirectory Type = RunCommand Description = "Ensure output directories exists" Debug = True CommandArgs = ( "OutputDir", "Region" ) Group = PreCommands Mkdir1 = "mkdir -p %1/Images" Mkdir2 = "mkdir -p %1/Overlaps/%2" EndGroup EndObject # Writes all files to CSV file that are in the region. It creates a file # in the local directory with the name .csv where is the # value contained in the Region definition file provided in GLOBALS # paramater. Object = Strategy Name = WriteRegionImages Type = CsvWriter Description = "Write images that are in the defined region to a file" CsvFile = "%1/Images/%2_images.csv" CsvFileArgs = ( "OutputDir", "Region" ) Mode = Create Header = true Keywords = (SourceProductId, YearDoy, File, Number, Lines, Samples, FocalPlaneTemperature, TempDependentFocalLength, StartTime, EtStartTime, ExposureDuration, HasNorthPole, HasSouthPole, HasLongitudeBoundary, Region, CenterLongitude, CenterLatitude, CenterRadius, ObservationType, PixelResolution, MeanGroundResolution, IncidenceAngle, EmissionAngle, PhaseAngle, SubSolarGroundAzimuth, SubSpacecraftGroundAzimuth, SubSpacecraftLongitude, SubSpacecraftLatitude, SubSolarLongitude, SubSolarLatitude, TargetCenterDistance, SlantDistance, ParallaxX, ParallaxY, ShadowX, ShadowY, GisPointsTolerance, GisPointsOriginal, GisPoints, GisFootprint) GisGeometryKey = GisFootprint GisType = WKB Delimiter = "," DefaultValue = "NULL" EndObject Object = Strategy # Determine images that overlaps for the selected ones Name = ImageOverlap Type = GisOverlap Description = "Find all overlaps images in specfied region" Asset = ImageOverlaps OverlapMerge = "ResourceB" ` # Select candidates from input list. Matches over itself. This one set # is used for all images that satisfy the regional limits. It can be # dangerous to try to limit the candidates, however, using all images will # make it slower since there are likely many more images to search # through. Object = CandidateMiner Object = Strategy Name = PairCandidates Type = ResourceManager Description = "Choose all resources to determine overlaping images" Operations = ResetDiscard EndObject EndObject # Could specify a filename of the following form. # OverlapConfigFile = "write_image_overlaps.conf" # This strategy is designed to process each Resource that has image overlaps. # This approach will allow users to better manage the volume of data that # will be generated from large runs of this operation. Specfically, the # ImageOverlaps Asset can be removed from each Resource as soon as it is # processed rather than wait till all are found and then results are written # in the same manner. Object = OverlapMiner Name = WriteImageOverlaps RequiredParameters = ( "OutputDir", "Region" ) Object = Strategy Name = WriteOverlapImages Type = CsvWriter CsvFile = "%1/Overlaps/%2/%3_overlaps.csv" CsvFileArgs = ( "OutputDir", "Region", "SourceProductId" ) Mode = Create Header = true Keywords = (SourceProductId, MatchedProductId, Region, OverlapRatioSource, OverlapRatioMatch, YearDoy, File, Number, Lines, Samples, FocalPlaneTemperature, TempDependentFocalLength, StartTime, EtStartTime, ExposureDuration, HasNorthPole, HasSouthPole, HasLongitudeBoundary, CenterLongitude, CenterLatitude, CenterRadius, ObservationType, PixelResolution, MeanGroundResolution, IncidenceAngle, EmissionAngle, PhaseAngle, SubSolarGroundAzimuth, SubSpacecraftGroundAzimuth, SubSpacecraftLongitude, SubSpacecraftLatitude, SubSolarLongitude, SubSolarLatitude, TargetCenterDistance, SlantDistance, ParallaxX, ParallaxY, ShadowX, ShadowY, GisFootprint) GisGeometryKey = GisFootprint GisType = WKB Delimiter = "," DefaultValue = "NULL" EndObject # Write the image overlaps to a CSV file. The files will be put in a directory # of the form "OutputDir/Region/SourceProductId_overlaps.csv" where # OutputDir is provided in the program PARAMETERS as the full base path to # the directory to write the files, and Region comes from the contents of # the GLOBALS file. # # This shows the use of the AssetSidebar strategy. Note the "Asset" keyword # is the same as the one specifed in StereoPair strategy above. All the # Strategy Objects listed in the IsisMiner object (a whole other CONFIG file), # will execute on any Resource that contains at least one stereo image pair. # # There is an Asset called ImageOverlaps, also a list of Resources, that just # happens to work perfectly for all the following Strategies. Remember # all Resource keywords containing the Asset are available in the global # parameter list and can be referenced as any keyword. Object = Strategy Name = WriteOverlapFiles Type = AssetSidebar Description = "Process all stereo pair assets" Asset = ImageOverlaps Operation = Append # Write all the overlapping images in the Resource Object = IsisMiner Object = Strategy # Sort the StereoPairs by rank Name = SortByOverLapRatio Type = NumericalSort Description = "Sort images by overlap ratio" SortKey = OverlapRatioB Order = Descending EndObject Object = Strategy # Write result of StereoPair strategy for each Resource that has a # StereoPairs asset. Name = WriteOverlapSet Type = CsvWriter Description = "Write individual files with overlapping images" Mode = Append Header = False SkipEmptyLists = True CsvFile = "%1/Overlaps/%2/%3_overlaps.csv" CsvFileArgs = ( "OutputDir", "Region", "SourceProductId" ) Keywords = (SourceProductIdB, SourceProductIdA, Region, OverlapRatioB, OverlapRatioA, YearDoyB, FileB, NumberB, LinesB, SamplesB, FocalPlaneTemperatureB, TempDependentFocalLengthB, StartTimeB, EtStartTimeB, ExposureDurationB, HasNorthPoleB, HasSouthPoleB, HasLongitudeBoundaryB, CenterLongitudeB, CenterLatitudeB, CenterRadiusB, ObservationTypeB, PixelResolutionB, MeanGroundResolutionB, IncidenceAngleB, EmissionAngleB, PhaseAngleB, SubSolarGroundAzimuthB, SubSpacecraftGroundAzimuthB, SubSpacecraftLongitudeB, SubSpacecraftLatitudeB, SubSolarLongitudeB, SubSolarLatitudeB, TargetCenterDistanceB, SlantDistanceB, ParallaxXB, ParallaxYB, ShadowXB, ShadowYB, GisFootprint) GisGeometryKey = GisFootprint GisType = WKB Delimiter = "," DefaultValue = "NULL" EndObject EndObject EndObject # Now remove the ImageOverlap asset from each Resource Object = Strategy Name = RemoveImageOverlaps Type = ResourceManager Description = "Delete ImageOverlaps asset to free memory (obsolete merged Resources from overlaping pairs)" Operations = DeleteAsset::ImageOverlaps EndObject # While we are at it, produce stereo pairs from the output CSV file. # This will require a CSV reader of the file just written and a StereoPair # strategy. The config file must be specified as a parameter to isisminer. # It must also assume there is a list of Resources that must be cleared # if the overlap file is used for processing. Object = Strategy Name = ProcessStereo Type = Sidebar Description = "Process overlap images to determine stereo set" SavePoint = True SaveDelete = True StrategyConfigFile = "%1" StrategyConfigFileArgs = "StereoConfig" EndObject EndObject EndObject EndObject End