Skip to content

u/v re-mapping consistency #7

@dgwyther

Description

@dgwyther

Hi folks

I'm looking for a bit of guidance concerning re-mapping between the rho and u/v grids in preprocess/load_ocean_data_roms.py.

I note that the other drivers (e.g. nemo) essentially load LEVOFU etc from the grid:

   # Ocean fraction at each level:
   LEVOFT = maskT*100.0
   LEVOFU = maskU*100.0
   LEVOFV = maskV*100.0

whereas ROMS calculates it quite elaborately:

DEPTHO = xr.DataArray( np.zeros((my,mx))*np.nan, dims=['eta_rho', 'xi_rho'] ) # bathymetry
DEPTHOT = DEPTHO.isel(xi_rho=slice(imin,imax+1),eta_rho=slice(jmin,jmax+1)) # subset bathymetry
DEPTHOU = xr.DataArray( 0.5 * (DEPTHOT.values+DEPTHOT.shift(xi_rho=1).values), dims=['eta_u', 'xi_u'] ) #subset bathymetry *roughly* (not exactly) on the u grid

ROMS has a mask_u variable in the grid file, which is ==1 for ocean and ==0 for land - is this equivalent to maskU in NEMO?

DEPTHOU is used a few lines below:

   LEVOFU = LEVOFU.where( ( (DepTUV==0.) & (DEPFLFU==0.) ) | ( (DEPTHOU>DepTUV) & (DEPFLFU<DepTUV) ), 0.e0 ) \
            * ncM.mask_u.isel(xi_u=slice(imin,imax+1),eta_u=slice(jmin,jmax+1))

I don't really understand what LEVOFU (depth of the u points?) is doing.

The reason I'm raising this possible issue, is that this line:

   LEVOFU = LEVOFU.where( ( (DepTUV==0.) & (DEPFLFU==0.) ) | ( (DEPTHOU>DepTUV) & (DEPFLFU<DepTUV) ), 0.e0 ) \
            * ncM.mask_u.isel(xi_u=slice(imin,imax+1),eta_u=slice(jmin,jmax+1))

can raise an error, depending on the test case. For example, with the ROMS_test case, it runs fine, but for a different grid size (my actual model data), this term ncM.mask_u.isel(xi_u=slice(imin,imax+1),eta_u=slice(jmin,jmax+1) has a different spatial size than DEPTHOU etc, as though the re-mapping to the u-grid by the .shift() command didn't work correctly.

I re-wrote the calculations of the DEPTHOFU and DEPTHOFV to be the averages of the rho points, and then made a new depth vector ztmp for the u, v, and rho grids. This seemed to work, but didn't work with the ROMS_test data.

So just looking for some thoughts on what might be going on. Any advice is appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions