コード例 #1
0
 def testBBMerge(self):
     bb1 = BoundingBox(latSouth=-55, lonWest=95, latNorth=-45, lonEast=109)
     bb2 = BoundingBox(latSouth=44, lonWest=-164, latNorth=74, lonEast=-35)
     bb = BoundingBox.mergedBoundingBoxes([bb1, bb2])
     assert_array_equal(
         [bb.latSouth, bb.latNorth, bb.lonWest, bb.lonEast],
         [bb1.latSouth, bb2.latNorth, bb1.lonWest, bb2.lonEast])
     assert_array_almost_equal(bb.center, [21.136113246, -150])
コード例 #2
0
    def testBBPole(self):
        # north pole
        bb = BoundingBox(latSouth=60, lonWest=-180, latNorth=90, lonEast=180)
        assert_array_almost_equal(bb.center, [90, 0])
        assert_array_almost_equal(bb.size, [6695.78581964, 6695.78581964])

        # south pole
        bb = BoundingBox(latSouth=-90, lonWest=-180, latNorth=-60, lonEast=180)
        assert_array_almost_equal(bb.center, [-90, 0])
        assert_array_almost_equal(bb.size, [6695.78581964, 6695.78581964])
コード例 #3
0
ファイル: boundingbox_test.py プロジェクト: dequis/auromat
 def testBBMerge(self):
     bb1 = BoundingBox(latSouth=-55, lonWest=95, latNorth=-45, lonEast=109)
     bb2 = BoundingBox(latSouth=44, lonWest=-164, latNorth=74, lonEast=-35)
     bb = BoundingBox.mergedBoundingBoxes([bb1,bb2])
     assert_array_equal([bb.latSouth,bb.latNorth,bb.lonWest,bb.lonEast],
                        [bb1.latSouth,bb2.latNorth,bb1.lonWest,bb2.lonEast])
     assert_array_almost_equal(bb.center, [21.136113246, -150])
コード例 #4
0
ファイル: draw_test.py プロジェクト: scivision/auromat
 def _testMLatMLTPolarMapBothHemispheres(self):
     m = _getMappingSouth()
     m.checkGuarantees()
     #m = m.maskedByElevation(10)
     #m.checkGuarantees()
     m = resample(m, arcsecPerPx=100, method='mean')
     m.checkGuarantees()
     seqbb = BoundingBox(latSouth=-61.150846231, lonWest=142.622725698, latNorth=6.84984918353, lonEast=-116.820615123)
     saveFig('test_mlatmlt_polar_seqbb.png', drawMLatMLTPolar(m, boundingBox=seqbb))
コード例 #5
0
 def testBBDiscontinuity(self):
     bb = BoundingBox(latSouth=-60.646114098,
                      lonWest=82.7852215499,
                      latNorth=-38.7515567117,
                      lonEast=-178.546517062)
     assert_array_almost_equal(bb.center,
                               [-54.33647117488648, 132.11935224395])
     assert_array_almost_equal(bb.size,
                               [8084.704893634039, 3464.8889697347718])
コード例 #6
0
ファイル: draw_test.py プロジェクト: scivision/auromat
 def _testParallelsMeridiansPlotOptimized(self):
     imagePath = getResourcePath('ISS030-E-102170_dc.jpg')
     wcsPath = getResourcePath('ISS030-E-102170_dc.wcs')
     # As we precalculated the bounding box and the lat/lon label position
     # we only need to access the 'latCenter', 'lonCenter' and 'intersectsEarth'
     # attributes of the spacecraft mapping. This means that we don't need
     # any sanitization applied on the corner coordinate arrays ('lats','lons').
     # For this reason, and because we don't use masking, we set nosanitize=True
     # and can cut the required time in half. 
     m = getMapping(imagePath, wcsPath, altitude=0, fastCenterCalculation=False, nosanitize=True)
     
     # the following values must be precalculated to use the optimization
     # the bounding box at altitude=0 without any masking
     bb = BoundingBox(latSouth=49.3401757697, lonWest=-116.368770925, latNorth=64.288454984, lonEast=-91.8890098192)
     # center of bounding box at altitude=0 when masked below 10deg elevation
     labelLat, labelLon = 53.133, -98.684
     
     figax = loadFigImage(imagePath)
     drawParallelsAndMeridians(figax, m, boundingBox=bb, labelLat=labelLat, labelLon=labelLon)
     drawConstellations(figax, wcsPath, clipPoly=outline(~m.intersectsEarth))
     saveFig('test_parallelsmeridians_optimized.jpg', figax)
コード例 #7
0
def getCalibrationData(path, station, date):
    
    calDataEntries = np.loadtxt(path, dtype={'names': ('station', 'lat', 'lon', 'from', 'to', 
                                                       'xc', 'yc', 'k', 'rotation', 'lat+', 'lat-', 
                                                       'lon-', 'lon+', 'i1', 'i2', 'i3'),
                                             'formats': ('S3', 'f8', 'f8', 'f8', 'f8', 
                                                         'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 
                                                         'f8', 'f8', 'b1', 'b1', 'b1')})
    for entry in calDataEntries:
        if entry['station'] != station:
            continue
        
        fromDateY = int(entry['from'])
        fromDateM = int((entry['from']-fromDateY)*12 + 1)
        toDateY = int(entry['to'])
        toDateM = int((entry['to']-toDateY)*12 + 1)
        
        fromDate = datetime.datetime(fromDateY, fromDateM, 1)
        toDate = datetime.datetime(toDateY, toDateM+1, 1) # easier than using end of month
        
        if not fromDate <= date <= toDate:
            continue
        
        lat = entry['lat']
        lon = entry['lon']
        
        bbSimple = BoundingBox(latSouth=lat+entry['lat-'], 
                               lonWest=lon+entry['lon-'], 
                               latNorth=lat+entry['lat+'], 
                               lonEast=lon+entry['lon+'])
        
        calData = CalibrationData(station=entry['station'], validFrom=fromDate, validTo=toDate, 
                                  lat=lat, lon=lon, 
                                  xc=entry['xc'], yc=entry['yc'], k=entry['k'],
                                  rotation=entry['rotation'], boundingBoxSimple=bbSimple)
        return calData
        
    raise ValueError('No MIRACLE calibration data found for ' + station + ' station')
コード例 #8
0
ファイル: draw_test.py プロジェクト: scivision/auromat
 def _testBBPole2(self):
     bb = BoundingBox(latSouth=35.3446724767, lonWest=-180.0, latNorth=90.0, lonEast=180.0)
     m = _getMappingNorth()
     m = resample(m, arcsecPerPx=100, method='mean')
     saveFig('test_bb.png', drawStereographic(m, boundingBox=bb))
コード例 #9
0
 def testBBPoint(self):
     bb = BoundingBox(latSouth=50, lonWest=80, latNorth=50, lonEast=80)
     assert_array_almost_equal(bb.center, [50, 80])
     assert_array_almost_equal(bb.size, 0)
コード例 #10
0
 def testBB(self):
     bb = BoundingBox(latSouth=-60, lonWest=80, latNorth=-30, lonEast=85)
     assert_array_almost_equal(bb.center, [-45.03119418083877, 82.5])
     assert_array_almost_equal(bb.size,
                               [482.39311013217343, 3336.5953086140203])