示例#1
0
             alpha=0.5,
             color="lightpink",
             edgecolor="grey")
    plt.ylabel("Frequency", fontsize=8)
    plt.xlabel("Longitude (decimal degrees)", fontsize=8)
    plt.xticks(fontsize=8)
    plt.yticks(fontsize=8)
    plt.legend()
    plt.savefig(destination_path)


if __name__ == "__main__":

    # Open CSV file with the occurrences data.
    base_path = "data/geodata/request_reports/"
    filter_hash = filter_hash(geodata_filter, species_list.species_list)
    csv_file_name = filter_hash + "_geodata.csv"
    df = create_dataframe_from_csv(base_path + csv_file_name)

    # Extract list with coordinates
    latitude = column_to_list(df, "decimal_latitude")
    longitude = column_to_list(df, "decimal_longitude")
    species_name = column_to_list(df, "species_name")
    coordinates_df = pd.DataFrame(
        list(zip(species_name, latitude, longitude)),
        columns=["species_name", "latitude", "longitude"])

    # Plot occurrences location
    destination_path = "data/geodata/outputs/occurrences_map.png"
    shape_file = "data/geodata/uk_maps/GBR_adm0.shp"  # UK map
    plot_occurrences_map(coordinates_df, shape_file, destination_path)
示例#2
0
    limit = images_filter.limit
    ###############################################

    # 2- Handle filter parameters
    filter = {
        "mediaType": media_type,
        "country": country,
        "hasCoordinate": has_coordinate,
        "kingdom": kingdom,
        "basisOfRecord": basis_of_record,
        "institutionCode": institution_code,
        "limit": limit
    }
    filter_information = images_filter.filter_information()
    ## Hash the filter information + species list string to use it for naming the results file
    filter_hash = filter_hash(images_filter, species_list)
    print(f"\nStarting request '{search_name}' identified by: {filter_hash}.")

    ## Save filter and species information to text file
    save_filter = open_filter_report(filter_hash)
    save_filter.write(f"{search_name}\n")
    save_filter.write(f"{str(filter_information)}\n")
    save_filter.write(f"Image download limit: {limit}\n\n")
    save_filter.write("Input species list:\n")
    for species in species_list:
        save_filter.write(f"{species}\n")
    save_filter.close()

    # 3- Get species keys (same as taxon key)
    species_taxon_key = get_taxon_key(species_list)
    ## Check if all species entered have a taxon key