コード例 #1
0
ファイル: test_extract.py プロジェクト: DataSounds/OceanSound
def setup_module(module):
    module.lat, module.lon = 0, 0
    module.indir = tempfile.mkdtemp()

    if not HAS_GDAL and not HAS_PYHDF:
        pytest.skip('You must have PyHDF or GDAL installed!')

    for test_file in TEST_FILES:
        urlretrieve(CONTAINER + test_file, os.path.join(indir, test_file))
    module.pyhdf = extract_series(lat, lon, indir, extract_pyhdf)
    module.gdal = extract_series(lat, lon, indir, extract_gdal)
    assert extract_pyhdf != extract_gdal
コード例 #2
0
ファイル: test_extract.py プロジェクト: Python3pkg/OceanSound
def setup_module(module):
    module.lat, module.lon = 0, 0
    module.indir = tempfile.mkdtemp()

    if not HAS_GDAL and not HAS_PYHDF:
        pytest.skip('You must have PyHDF or GDAL installed!')

    for test_file in TEST_FILES:
        urlretrieve(CONTAINER + test_file, os.path.join(indir, test_file))
    module.pyhdf = extract_series(lat, lon, indir, extract_pyhdf)
    module.gdal = extract_series(lat, lon, indir, extract_gdal)
    assert extract_pyhdf != extract_gdal
コード例 #3
0
ファイル: run.py プロジェクト: DataSounds/OceanSound
def do_calc(LATLIMS_AM, LONLIMS_AM, indir, outdir):
    land_checker = Basemap()
    if land_checker.is_land(LATLIMS_AM, LONLIMS_AM):
        print "SOS! Sorry you have selected a land pixel!"
        pygame.mixer.music.load("SOS.midi")
        pygame.mixer.music.play()
        while pygame.mixer.music.get_busy():
            # plot animado?
            time.sleep(1)
    else:
        dataAM = extract_series(LATLIMS_AM, LONLIMS_AM, indir)
        data_am = np.double(dataAM["Series"])
        if all(np.isnan(a) for a in data_am):
            print "THE SOUND OF SILENCE. Also, BATMAN. Everything is Rest and NaN"
            pygame.mixer.music.load("Batman_song.midi")
            pygame.mixer.music.play()
            while pygame.mixer.music.get_busy():
                # Anim plot? See Matplotlib.Animation
                time.sleep(1)
        else:
            am = get_music(data_am)

            music = pygame.mixer.Sound("Oc.midi")
            pygame.mixer.music.load("Oc.midi")
            pygame.mixer.music.play()
            anim = plot_animation(
                data_am,
                (u"Music from Lat = %.2f Lon = %.2f" % (dataAM["Lat"], dataAM["Lon"])),
                "serie.png",
                t_max=36000,
            )  # music.get_length())
コード例 #4
0
ファイル: run.py プロジェクト: Python3pkg/OceanSound
def do_calc(LATLIMS_AM, LONLIMS_AM, indir, outdir):
    land_checker = Basemap()
    if land_checker.is_land(LATLIMS_AM, LONLIMS_AM):
        print('SOS! Sorry you have selected a land pixel!')
        pygame.mixer.music.load('SOS.midi')
        pygame.mixer.music.play()
        while pygame.mixer.music.get_busy():
            #plot animado?
            time.sleep(1)
    else:
        dataAM = extract_series(LATLIMS_AM, LONLIMS_AM, indir)
        data_am = np.double(dataAM['Series'])
        if all(np.isnan(a) for a in data_am):
            print(
                'THE SOUND OF SILENCE. Also, BATMAN. Everything is Rest and NaN'
            )
            pygame.mixer.music.load('Batman_song.midi')
            pygame.mixer.music.play()
            while pygame.mixer.music.get_busy():
                # Anim plot? See Matplotlib.Animation
                time.sleep(1)
        else:
            am = get_music(data_am)

            music = pygame.mixer.Sound('Oc.midi')
            pygame.mixer.music.load('Oc.midi')
            pygame.mixer.music.play()
            anim = plot_animation(data_am,
                                  ('Music from Lat = %.2f Lon = %.2f' %
                                   (dataAM['Lat'], dataAM['Lon'])),
                                  'serie.png',
                                  t_max=36000)  #music.get_length())
コード例 #5
0
def gen_music(lat, lon, datadir):
    data_am = extract_series(lat, lon, datadir)
    am = get_music(data_am['Series'])

    return am, data_am['Series'], data_am['Lat'], data_am['Lon']