예제 #1
0
def make_stations_from_metadata(profile=None):
    print "Making stations from filesystem"
    station_type_dict = generic_processor.get_dictionary_from_filesystem("station",
                                                                         "properties",
                                                                         profile=profile)
    data_type_dict = generic_processor.get_dictionary_from_filesystem("datatype",
                                                                      "properties",
                                                                      profile=profile)
    stations = make_all_station_types(station_type_dict, data_type_dict, profile=profile)
    print len(stations), " (number of stations created)"
    print "Clearing mongo stations collection"
    remove_status = mongo_dao.remove_station_collection()
    print remove_status, " (None means station collection removal success)"
    station_collection = create_station_collection(stations)
    print station_collection, " (station collection pointer)"
    all_returned_stations = get_all_stations()
    print len(all_returned_stations), " (all stations in mongo)"
    ghcnm_returned_stations = get_all_stations_by_program("ghcnm")
    print len(ghcnm_returned_stations), " (ghcnm stations in mongo)"
    ushcn_returned_stations = get_all_stations_by_program("ushcn")
    print len(ushcn_returned_stations), " (ushcn stations in mongo)"
    northam_returned_stations = get_all_stations_by_program("northam")
    print len(northam_returned_stations), " (northam stations in mongo)"
    print "Testing adding geospatial index"
    result = add_station_geospatial_index()
    print result, " (result of adding station geospatial index)"
    print "Testing geoindex search"
    program = "ghcnm"  # program for testing
    test1_stations = get_random_program_stations(program)
    print len(test1_stations), ' (length of test stations)'
    print test1_stations[0]
    status = write_station_records(test1_stations, program, utils.get_timestamp(), profile=profile)
    print status, '(status of effort)'
예제 #2
0
def remove_station_collection():
    """Completely removes a station collection from storage.
    """
    mongo_dao.remove_station_collection()
    return "Successfully removed station collection."