src/coecms/um/um2oasis.py
def mom_t_scrip_grid(gridspec):
    """
    Create a SCRIP description of the MOM tracer grid

    Args:
        gridspec (xarray.DataArray): MOM grid_spec.nc data

    Returns:
        xarray.DataArray containing the SCRIP description
    """
    grid_dims = xarray.DataArray(list(reversed(gridspec.wet.shape)), dims='grid_rank')

    area = gridspec.AREA_OCN.values
    mask = gridspec.wet

    ds = xarray.Dataset({
            'grid_dims': grid_dims,
            'grid_center_lat': gridspec.y_T,
            'grid_center_lon': gridspec.x_T,
            'grid_corner_lat': gridspec.y_vert_T,
            'grid_corner_lon': gridspec.x_vert_T,
            'grid_area': (['grid_y_T', 'grid_x_T'], area),
            'grid_imask': (['grid_y_T', 'grid_x_T'], mask),
        })
    ds = ds.rename({'vertex': 'grid_corners'})
    ds.grid_center_lat.attrs['units'] = 'degrees'
    ds.grid_center_lon.attrs['units'] = 'degrees'
    ds.grid_corner_lat.attrs['units'] = 'degrees'
    ds.grid_corner_lon.attrs['units'] = 'degrees'
    ds = ds.stack(grid_size=('grid_y_T','grid_x_T')).reset_index('grid_size')
    ds['grid_corner_lon'] = ds['grid_corner_lon'].transpose()
    ds['grid_corner_lat'] = ds['grid_corner_lat'].transpose()

    del ds['grid_x_T']
    del ds['grid_y_T']
    return ds

    Create a SCRIP description of the MOM tracer grid

    Args:
        gridspec (xarray.DataArray): MOM grid_spec.nc data

    Returns:
        xarray.DataArray containing the SCRIP description
    
Create a SCRIP description of the MOM tracer grid
Create a SCRIP description of the MOM tracer grid
def mom_t_scrip_grid(gridspec):
    grid_dims = xarray.DataArray(list(reversed(gridspec.wet.shape)), dims='grid_rank')
    area = gridspec.AREA_OCN.values
    mask = gridspec.wet
    ds = xarray.Dataset({
            'grid_dims': grid_dims,
            'grid_center_lat': gridspec.y_T,
            'grid_center_lon': gridspec.x_T,
            'grid_corner_lat': gridspec.y_vert_T,
            'grid_corner_lon': gridspec.x_vert_T,
            'grid_area': (['grid_y_T', 'grid_x_T'], area),
            'grid_imask': (['grid_y_T', 'grid_x_T'], mask),
        })
    ds = ds.rename({'vertex': 'grid_corners'})
    ds.grid_center_lat.attrs['units'] = 'degrees'
    ds.grid_center_lon.attrs['units'] = 'degrees'
    ds.grid_corner_lat.attrs['units'] = 'degrees'
    ds.grid_corner_lon.attrs['units'] = 'degrees'
    ds = ds.stack(grid_size=('grid_y_T','grid_x_T')).reset_index('grid_size')
    ds['grid_corner_lon'] = ds['grid_corner_lon'].transpose()
    ds['grid_corner_lat'] = ds['grid_corner_lat'].transpose()
    del ds['grid_x_T']
    del ds['grid_y_T']
    return ds
def mom_t_scrip_grid ( gridspec ) : grid_dims = xarray . DataArray ( list ( reversed ( gridspec . wet . shape ) ) , dims = 'grid_rank' ) area = gridspec . AREA_OCN . values mask = gridspec . wet ds = xarray . Dataset ( { 'grid_dims' : grid_dims , 'grid_center_lat' : gridspec . y_T , 'grid_center_lon' : gridspec . x_T , 'grid_corner_lat' : gridspec . y_vert_T , 'grid_corner_lon' : gridspec . x_vert_T , 'grid_area' : ( [ 'grid_y_T' , 'grid_x_T' ] , area ) , 'grid_imask' : ( [ 'grid_y_T' , 'grid_x_T' ] , mask ) , } ) ds = ds . rename ( { 'vertex' : 'grid_corners' } ) ds . grid_center_lat . attrs [ 'units' ] = 'degrees' ds . grid_center_lon . attrs [ 'units' ] = 'degrees' ds . grid_corner_lat . attrs [ 'units' ] = 'degrees' ds . grid_corner_lon . attrs [ 'units' ] = 'degrees' ds = ds . stack ( grid_size = ( 'grid_y_T' , 'grid_x_T' ) ) . reset_index ( 'grid_size' ) ds [ 'grid_corner_lon' ] = ds [ 'grid_corner_lon' ] . transpose ( ) ds [ 'grid_corner_lat' ] = ds [ 'grid_corner_lat' ] . transpose ( ) del ds [ 'grid_x_T' ] del ds [ 'grid_y_T' ] return ds
Create a SCRIP description of the MOM tracer grid
Create a SCRIP description of the MOM tracer grid
"""
    Create a SCRIP description of the MOM tracer grid

    Args:
        gridspec (xarray.DataArray): MOM grid_spec.nc data

    Returns:
        xarray.DataArray containing the SCRIP description
    """
xarray.DataArray containing the SCRIP description
xarray . DataArray containing the SCRIP description
gridspec
MOM grid_spec.nc data
MOM grid_spec . nc data