Ejemplo n.º 1
0
def main():
    author = 'Milena Veneziani'

    # make a geometric features object that knows about the geometric data
    # cache up a couple of directories
    gf = GeometricFeatures(cacheLocation='../../geometric_data')

    fc = FeatureCollection()

    # ********* OSNAP array West *********

    # Read in OSNAP West lon,lat
    OSNAPwestLonLat = csv.reader(open('./OSNAParrayWest20210322.csv', 'r'))
    # Skip 4 header lines
    next(OSNAPwestLonLat, None)
    next(OSNAPwestLonLat, None)
    next(OSNAPwestLonLat, None)
    next(OSNAPwestLonLat, None)
    coords = []
    for line in OSNAPwestLonLat:
        coords.append([float(line[0]), float(line[1])])

    feature = {}
    feature['type'] = 'Feature'
    feature['properties'] = {}
    feature['properties']['name'] = 'OSNAP section West'
    feature['properties']['tags'] = 'arctic_sections'
    feature['properties']['object'] = 'transect'
    feature['properties']['component'] = 'ocean'
    feature['properties']['author'] = author
    feature['geometry'] = {}
    feature['geometry']['type'] = 'LineString'
    feature['geometry']['coordinates'] = coords
    fcOW = FeatureCollection([feature])
    fcOW.plot(projection='northpole')
    fc.merge(fcOW)

    # ********* OSNAP array East *********

    # Read in OSNAP East lon,lat
    OSNAPeastLonLat = csv.reader(open('./OSNAParrayEast20210322.csv', 'r'))
    # Skip 4 header lines
    next(OSNAPeastLonLat, None)
    next(OSNAPeastLonLat, None)
    next(OSNAPeastLonLat, None)
    next(OSNAPeastLonLat, None)
    coords = []
    for line in OSNAPeastLonLat:
        coords.append([float(line[0]), float(line[1])])

    feature = {}
    feature['type'] = 'Feature'
    feature['properties'] = {}
    feature['properties']['name'] = 'OSNAP section East'
    feature['properties']['tags'] = 'arctic_sections'
    feature['properties']['object'] = 'transect'
    feature['properties']['component'] = 'ocean'
    feature['properties']['author'] = author
    feature['geometry'] = {}
    feature['geometry']['type'] = 'LineString'
    feature['geometry']['coordinates'] = coords
    fcOE = FeatureCollection([feature])
    fcOE.plot(projection='northpole')
    fc.merge(fcOE)

    # "split" these features into individual files in the geometric data cache
    gf.split(fc)

    # update the database of feature names and tags
    write_feature_names_and_tags(gf.cacheLocation)
    # move the resulting file into place
    shutil.copyfile('features_and_tags.json',
                    '../../geometric_features/features_and_tags.json')

    plt.show()
Ejemplo n.º 2
0
def main():
    author = 'Xylar Asay-Davis, Alice Barthel, Nicolas Jourdain'
    tags = 'Antarctic;ISMIP6'

    # make a geometric features object that knows about the geometric data
    # cache up a couple of directories
    gf = GeometricFeatures('../../geometric_data')

    bedmap2_bin_to_netcdf('bedmap2.nc')

    fcContour1500 = get_longest_contour(contourValue=-1500., author=author)

    fc = FeatureCollection()

    lons = [-65., -25., -25., -65.]
    lats = [-80., -80., -77., -71.]
    fc.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Weddell Sea',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    lons = [-128., -128., -90., -90.]
    lats = [-76., -69., -69., -76.]
    fc.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Amundsen Sea',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    lons = [45., 45., 90., 90.]
    lats = [-70., -60., -60., -70.]
    fc.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Amery Sector',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    lons = [-22.5, -22.5, 22.5, 22.5]
    lats = [-75., -65., -65., -75.]
    fc.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Dronning Maud Land',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    lons = [110., 110., 130., 130.]
    lats = [-70., -60., -60., -70.]
    fc.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Totten Region',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    lons = [165., 165., 180., 180.]
    lats = [-80., -71., -73., -80.]
    fc_ross = shelf_polygon(lons,
                            lats,
                            name='ISMIP6 Western Ross Sea',
                            author=author,
                            tags=tags,
                            fcContour=fcContour1500)

    lons = [-180., -180., -150., -150.]
    lats = [-80., -73., -77., -80.]
    fc_ross.merge(
        shelf_polygon(lons,
                      lats,
                      name='ISMIP6 Eastern Ross Sea',
                      author=author,
                      tags=tags,
                      fcContour=fcContour1500))

    old_props = fc_ross.features[0]['properties']
    fc_ross = fc_ross.combine('ISMIP6 Ross Sea')
    props = fc_ross.features[0]['properties']
    for prop in ['tags', 'zmin', 'zmax']:
        props[prop] = old_props[prop]

    fc.merge(fc_ross)

    fc.plot(projection='southpole')
    fc.to_geojson('ismip6_antarctic_ocean_regions.geojson')

    # "split" these features into individual files in the geometric data cache
    gf.split(fc)

    # update the database of feature names and tags
    write_feature_names_and_tags(gf.cacheLocation)
    # move the resulting file into place
    shutil.copyfile('features_and_tags.json',
                    '../../geometric_features/features_and_tags.json')

    plt.show()
# create a GeometricFeatures object that points to a local cache of geometric
# data and knows which branch of geometric_feature to use to download
# missing data
gf = GeometricFeatures('./geometric_data')

# create a FeatureCollection containing all iceshelf regions wtih one of the
# 27 IMBIE basin tags tags
fc = FeatureCollection()
for basin in range(1, 28):
    print('Adding feature from IMBIE basin {:d}'.format(basin))
    basinName = 'Antarctica_IMBIE{:d}'.format(basin)
    tags = [basinName]
    # load the iceshelf regions for one IMBIE basin
    fcBasin = gf.read(componentName='iceshelves',
                      objectType='region',
                      tags=tags)

    # combine all regions in the basin into a single feature
    fcBasin = fcBasin.combine(featureName=basinName)

    # merge the feature for the basin into the collection of all basins
    fc.merge(fcBasin)

# save the feature collection to a geojson file
fc.to_geojson('Extended_Antarctic_Basins.geojson')

if plot:
    fc.plot(projection='southpole')
    plt.show()
Ejemplo n.º 4
0
def main():
    author = 'Xylar Asay-Davis'
    timTags = 'Antarctic;Timmermann'
    orsiTags = 'Antarctic;Orsi'

    # make a geometric fieatures object that knows about the geometric data
    # cache up a couple of directories
    gf = GeometricFeatures('../../geometric_data')

    bedmap2_bin_to_netcdf('bedmap2.nc')

    fcContour700 = get_longest_contour(contourValue=-700., author=author)
    fcContour800 = get_longest_contour(contourValue=-800., author=author)

    fc = FeatureCollection()

    fcWeddell = split_rectangle(lon0=-63.,
                                lon1=0.,
                                lat0=-80.,
                                lat1=-65.,
                                name='Weddell Sea',
                                author=author,
                                tags=timTags,
                                fcContour=fcContour800)

    # get rid of the Weddell Sea because we're not that happy with this
    # definition, but keep the deep/shelf ones
    fcWeddell.features = fcWeddell.features[1:]
    fc.merge(fcWeddell)

    fcEW = split_rectangle(lon0=-20.,
                           lon1=25.,
                           lat0=-80.,
                           lat1=-55.,
                           name='Eastern Weddell Sea',
                           author=author,
                           tags=orsiTags,
                           fcContour=fcContour800)

    fc.merge(fcEW)

    fcWW = split_rectangle(lon0=-63.,
                           lon1=-20.,
                           lat0=-80.,
                           lat1=-60.,
                           name='Western Weddell Sea',
                           author=author,
                           tags=orsiTags,
                           fcContour=fcContour800)

    fc.merge(fcWW)

    # The Weddell feature is the sum of the Eastern and Western features before
    # splitting into shelf/deep

    fcWeddell = FeatureCollection()
    fcWeddell.features.append(fcEW.features[0])
    fcWeddell.features.append(fcWW.features[0])

    # now combine these into a single feature
    fcWeddell = fcWeddell.combine('Weddell Sea')
    props = fcWeddell.features[0]['properties']
    props['tags'] = orsiTags
    props['zmin'] = -1000.
    props['zmax'] = -400.

    fc.merge(fcWeddell)

    # add the Weddell Sea back as the sum of Eastern and Western
    fc.merge(
        make_rectangle(lon0=-63.,
                       lon1=45.,
                       lat0=-80.,
                       lat1=-58.,
                       name='Weddell Sea',
                       author=author,
                       tags=orsiTags))

    fc.merge(
        split_rectangle(lon0=-100.,
                        lon1=-63.,
                        lat0=-80.,
                        lat1=-67.,
                        name='Bellingshausen Sea',
                        author=author,
                        tags=timTags,
                        fcContour=fcContour700))

    fc.merge(
        split_rectangle(lon0=-140.,
                        lon1=-100.,
                        lat0=-80.,
                        lat1=-67.,
                        name='Amundsen Sea',
                        author=author,
                        tags=timTags,
                        fcContour=fcContour800))

    fc.merge(
        split_rectangle(lon0=-180.,
                        lon1=-140.,
                        lat0=-80.,
                        lat1=-67.,
                        name='Eastern Ross Sea',
                        author=author,
                        tags=timTags,
                        fcContour=fcContour700))

    fc.merge(
        split_rectangle(lon0=160.,
                        lon1=180.,
                        lat0=-80.,
                        lat1=-67.,
                        name='Western Ross Sea',
                        author=author,
                        tags=timTags,
                        fcContour=fcContour700))

    fc.merge(
        split_rectangle(lon0=25.,
                        lon1=160.,
                        lat0=-80.,
                        lat1=-62.,
                        name='East Antarctic Seas',
                        author=author,
                        tags=orsiTags,
                        fcContour=fcContour800))

    fc.merge(
        make_rectangle(lon0=-180.,
                       lon1=180.,
                       lat0=-80.,
                       lat1=-60.,
                       name='Southern Ocean 60S',
                       author=author,
                       tags=timTags))

    fcSO = gf.read('ocean', 'region', ['Southern Ocean'])
    props = fcSO.features[0]['properties']
    props['zmin'] = -1000.
    props['zmax'] = -400.

    fc.merge(fcSO)

    fc.plot(projection='southpole')
    fc.to_geojson('antarctic_ocean_regions.geojson')

    # "split" these features into individual files in the geometric data cache
    gf.split(fc)

    # update the database of feature names and tags
    write_feature_names_and_tags(gf.cacheLocation)
    # move the resulting file into place
    shutil.copyfile('features_and_tags.json',
                    '../../geometric_features/features_and_tags.json')

    plt.show()