This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_pin_files(data_frame, outdir = '/outdir/path/only/' ): | |
""" | |
Batch process the creation of BEAM-VISAT (http://www.brockmann-consult.de/cms/web/beam/) pin files. | |
Outputs a "pin_sampling_date_batched.placemark" file. | |
Uses pandas data_frame as input. | |
Expected column names in the input data frame are: | |
["IS_DATE"] YYYYMMDD format | |
["SITE"] Name of the Placemark, ie. station, sampling site or Cast ID | |
["Latitude"] Latitude of Placemark in decimal degrees using WGS84 datum | |
["Longitude"] Longitude of Placemark in decimal degrees using WGS84 datum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
__author__ = "[José M. Beltrán](<[email protected]>)" | |
__credits__ = ["José M. Beltrán"] | |
__license__ = "GPL-3.0" | |
""" | |
The json file has the following scheme: | |
{"20020614":{"KEY1":{"KEY1.1":"path_to_file_01", ...}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from matplotlib.collections import PatchCollection | |
from descartes import PolygonPatch | |
import fiona | |
from shapely.geometry import Polygon, MultiPolygon, shape | |
# We can extract the London Borough boundaries by filtering on the AREA_CODE key | |
mp = MultiPolygon( | |
[shape(pol['geometry']) for pol in fiona.open('data/boroughs/boroughs.shp') | |
if pol['properties']['AREA_CODE'] == 'LBO']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dropping a database via pymongo | |
from pymongo import Connection | |
c = Connection() | |
c.drop_database('mydatabase') | |
# drop a collection via pymongo | |
from pymongo import Connection | |
c = Connection() | |
c['mydatabase'].drop_collection('mycollection') |