Ejemplo n.º 1
0
    def get_stereographic_array_descriptor(self):

        # projection for BEDMAP2 and other common Antarctic data sets
        projection = pyproj.Proj('+proj=stere +lat_ts=-71.0 +lat_0=-90 '
                                 '+lon_0=0.0  +k_0=1.0 +x_0=0.0 +y_0=0.0 '
                                 '+ellps=WGS84')

        # a square 61x61 cell map with 100 km resolution and
        xMax = 3000e3
        res = 100e3
        nx = 2 * int(xMax / res) + 1
        x = numpy.linspace(-xMax, xMax, nx)
        meshName = '{}km_Antarctic_stereo'.format(int(res * 1e-3))
        descriptor = ProjectionGridDescriptor.create(projection, x, x,
                                                     meshName)
        return descriptor
Ejemplo n.º 2
0
def _get_arctic_stereographic_comparison_descriptor(config):  # {{{
    """
    Get a descriptor of an Arctic stereographic comparison grid, used for
    remapping and determining the grid name

    Parameters
    ----------
    config :  instance of ``MpasAnalysisConfigParser``
        Contains configuration options

    Returns
    -------
    descriptor : ``ProjectionGridDescriptor`` object
        A descriptor of the Arctic comparison grid
    """
    # Authors
    # -------
    # Milena Veneziani

    climSection = 'climatology'

    comparisonStereoWidth = config.getfloat(climSection,
                                            'comparisonArcticStereoWidth')
    comparisonStereoResolution = config.getfloat(
        climSection, 'comparisonArcticStereoResolution')

    projection = get_arctic_stereographic_projection()

    xMax = 0.5 * comparisonStereoWidth * 1e3
    nx = int(comparisonStereoWidth / comparisonStereoResolution) + 1
    x = numpy.linspace(-xMax, xMax, nx)

    meshName = '{}x{}km_{}km_Arctic_stereo'.format(comparisonStereoWidth,
                                                   comparisonStereoWidth,
                                                   comparisonStereoResolution)
    descriptor = ProjectionGridDescriptor.create(projection, x, x, meshName)

    return descriptor  # }}}
Ejemplo n.º 3
0
if args.method not in ['bilinear', 'neareststod', 'conserve']:
    raise ValueError('Unexpected method {}'.format(args.method))

dsIn = xarray.open_dataset(args.inFileName)

x = dsIn.x.values
y = dsIn.y.values
dx = int((x[1] - x[0]) / 1000.)
Lx = int((x[-1] - x[0]) / 1000.)
Ly = int((y[-1] - y[0]) / 1000.)

inMeshName = '{}x{}km_{}km_Antarctic_stereo'.format(Lx, Ly, dx)

projection = get_antarctic_stereographic_projection()

inDescriptor = ProjectionGridDescriptor.create(projection, x, y, inMeshName)

outRes = args.resolution * 1e3

nxOut = int((x[-1] - x[0]) / outRes + 0.5) + 1
nyOut = int((y[-1] - y[0]) / outRes + 0.5) + 1

xOut = x[0] + outRes * numpy.arange(nxOut)
yOut = y[0] + outRes * numpy.arange(nyOut)

outMeshName = '{}x{}km_{}km_Antarctic_stereo'.format(Lx, Ly, args.resolution)

outDescriptor = ProjectionGridDescriptor.create(projection, xOut, yOut,
                                                outMeshName)

mappingFileName = 'map_{}_to_{}_{}.nc'.format(inMeshName, outMeshName,