src/coecms/um/um2oasis.py
def rename_weights_esmf_to_scrip(ds):
    """
    Rename fields in a ESMF_RegridWeightGen weights file to the format used by
    SCRIP

    Args:
        ds (xarray.DataArray): ESMF weights data

    Returns:
        xarray.DataArray with SCRIP field names
    """

    ds = ds.rename({
        'n_s': 'num_links',
        'n_a': 'src_grid_size',
        'n_b': 'dst_grid_size',
        'nv_a': 'src_grid_corners',
        'nv_b': 'dst_grid_corners',
        'area_a': 'src_grid_area',
        'area_b': 'dst_grid_area',
        'frac_a': 'src_grid_frac',
        'frac_b': 'dst_grid_frac',
        'xc_a': 'src_grid_center_lat',
        'xc_b': 'dst_grid_center_lat',
        'yc_a': 'src_grid_center_lon',
        'yc_b': 'dst_grid_center_lon',
        'xv_a': 'src_grid_corner_lat',
        'xv_b': 'dst_grid_corner_lat',
        'yv_a': 'src_grid_corner_lon',
        'yv_b': 'dst_grid_corner_lon',
        'col': 'src_address',
        'row': 'dst_address',
        'S': 'remap_matrix',
        })
    ds['remap_matrix'] = ds.remap_matrix.expand_dims('num_wgts').transpose()
    ds.attrs['conventions'] = 'SCRIP'
    return ds

    Rename fields in a ESMF_RegridWeightGen weights file to the format used by
    SCRIP

    Args:
        ds (xarray.DataArray): ESMF weights data

    Returns:
        xarray.DataArray with SCRIP field names
    
Rename fields in a ESMF_RegridWeightGen weights file to the format used by
SCRIP
Rename fields in a ESMF_RegridWeightGen weights file to the format used by SCRIP
def rename_weights_esmf_to_scrip(ds):
    ds = ds.rename({
        'n_s': 'num_links',
        'n_a': 'src_grid_size',
        'n_b': 'dst_grid_size',
        'nv_a': 'src_grid_corners',
        'nv_b': 'dst_grid_corners',
        'area_a': 'src_grid_area',
        'area_b': 'dst_grid_area',
        'frac_a': 'src_grid_frac',
        'frac_b': 'dst_grid_frac',
        'xc_a': 'src_grid_center_lat',
        'xc_b': 'dst_grid_center_lat',
        'yc_a': 'src_grid_center_lon',
        'yc_b': 'dst_grid_center_lon',
        'xv_a': 'src_grid_corner_lat',
        'xv_b': 'dst_grid_corner_lat',
        'yv_a': 'src_grid_corner_lon',
        'yv_b': 'dst_grid_corner_lon',
        'col': 'src_address',
        'row': 'dst_address',
        'S': 'remap_matrix',
        })
    ds['remap_matrix'] = ds.remap_matrix.expand_dims('num_wgts').transpose()
    ds.attrs['conventions'] = 'SCRIP'
    return ds
def rename_weights_esmf_to_scrip ( ds ) : ds = ds . rename ( { 'n_s' : 'num_links' , 'n_a' : 'src_grid_size' , 'n_b' : 'dst_grid_size' , 'nv_a' : 'src_grid_corners' , 'nv_b' : 'dst_grid_corners' , 'area_a' : 'src_grid_area' , 'area_b' : 'dst_grid_area' , 'frac_a' : 'src_grid_frac' , 'frac_b' : 'dst_grid_frac' , 'xc_a' : 'src_grid_center_lat' , 'xc_b' : 'dst_grid_center_lat' , 'yc_a' : 'src_grid_center_lon' , 'yc_b' : 'dst_grid_center_lon' , 'xv_a' : 'src_grid_corner_lat' , 'xv_b' : 'dst_grid_corner_lat' , 'yv_a' : 'src_grid_corner_lon' , 'yv_b' : 'dst_grid_corner_lon' , 'col' : 'src_address' , 'row' : 'dst_address' , 'S' : 'remap_matrix' , } ) ds [ 'remap_matrix' ] = ds . remap_matrix . expand_dims ( 'num_wgts' ) . transpose ( ) ds . attrs [ 'conventions' ] = 'SCRIP' return ds
Rename fields in a ESMF_RegridWeightGen weights file to the format used by
SCRIP
Rename fields in a ESMF_RegridWeightGen weights file to the format used by SCRIP
"""
    Rename fields in a ESMF_RegridWeightGen weights file to the format used by
    SCRIP

    Args:
        ds (xarray.DataArray): ESMF weights data

    Returns:
        xarray.DataArray with SCRIP field names
    """
xarray.DataArray with SCRIP field names
xarray . DataArray with SCRIP field names
ds
ESMF weights data
ESMF weights data