def build_ocean_basins(gf, plot): ''' Builds features defining the major ocean basins Parameters ---------- gf : ``GeometricFeatures`` An object that knows how to download and read geometric featuers plot : bool Whether to plot each basin Returns ------- fc : ``FeatureCollection`` The new feature collection ''' # Authors # ------- # Xylar Asay-Davis fc = FeatureCollection() fc.set_group_name(groupName='OceanBasinRegionsGroup') # build ocean basins from regions with the appropriate tags for oceanName in [ 'Atlantic', 'Pacific', 'Indian', 'Arctic', 'Southern_Ocean', 'Mediterranean' ]: basinName = '{}_Basin'.format(oceanName) print(oceanName) print(' * merging features') fcBasin = gf.read(componentName='ocean', objectType='region', tags=[basinName]) print(' * combining features') fcBasin = fcBasin.combine(featureName=basinName) fc.merge(fcBasin) if plot: fcBasin.plot(projection='cyl') plt.title(oceanName) # add the global ocean, global ocean between 65S and 65S, and # equatorial region fc.merge( gf.read(componentName='ocean', objectType='region', featureNames=[ 'Global Ocean', 'Global Ocean 65N to 65S', 'Global Ocean 15S to 15N' ])) return fc
def build_MOC_basins(gf): ''' Builds features defining the ocean basins used in computing the meridional overturning circulation (MOC) Parameters ---------- gf : ``GeometricFeatures`` An object that knows how to download and read geometric featuers Returns ------- fc : ``FeatureCollection`` The new feature collection ''' # Authors # ------- # Xylar Asay-Davis MOCSubBasins = { 'Atlantic': ['Atlantic', 'Mediterranean'], 'IndoPacific': ['Pacific', 'Indian'], 'Pacific': ['Pacific'], 'Indian': ['Indian'] } MOCSouthernBoundary = { 'Atlantic': '34S', 'IndoPacific': '34S', 'Pacific': '6S', 'Indian': '6S' } fc = FeatureCollection() fc.set_group_name(groupName='MOCBasinRegionsGroup') # build MOC basins from regions with the appropriate tags for basinName in MOCSubBasins: print('{} MOC'.format(basinName)) print(' * merging features') tags = ['{}_Basin'.format(basin) for basin in MOCSubBasins[basinName]] fcBasin = gf.read(componentName='ocean', objectType='region', tags=tags, allTags=False) print(' * combining features') fcBasin = fcBasin.combine(featureName='{}_MOC'.format(basinName)) print(' * masking out features south of MOC region') maskName = 'MOC mask {}'.format(MOCSouthernBoundary[basinName]) fcMask = gf.read(componentName='ocean', objectType='region', featureNames=[maskName]) # mask out the region covered by the mask fcBasin = fcBasin.difference(fcMask) # remove various small polygons that are not part of the main MOC # basin shapes. Most are tiny but one below Australia is about 20 # deg^2, so make the threshold 100 deg^2 to be on the safe side. fcBasin = remove_small_polygons(fcBasin, minArea=100.) # add this basin to the full feature collection fc.merge(fcBasin) return fc