I am trying to create nested grid and contact netcdf file using ROMS Matlab routine.

I made a child grid, but when I tried to create contact file, I had a couple of errors.

By the way, I've created a grid file with spherical coordinate.

First error is near line 720 in contact.m

Code: Select all

```
Undefined function or variable 'FCr'.
Error in contact>refine_coordinates (line 724)
FSr.Values = G(dg).angle(:); R.angle = FCr(XrF, YrF);
```

Originally,

Code: Select all

```
elseif (~isempty(G(dg).lon_rho) && ~isempty(G(dg).lat_rho))
FSr.Values = G(dg).angle(:); R.angle = FCr(XrF, YrF);
FSr.Values = G(dg).f(:); R.f = FCr(XrF, YrF);
FSr.Values = G(dg).h(:); R.h = FCr(XrF, YrF);
```

The above lines should be

Code: Select all

```
elseif (~isempty(G(dg).lon_rho) && ~isempty(G(dg).lat_rho))
FSr.Values = G(dg).angle(:); R.angle = FSr(XrF, YrF);
FSr.Values = G(dg).f(:); R.f = FSr(XrF, YrF);
FSr.Values = G(dg).h(:); R.h = FSr(XrF, YrF);
```

Then, after I modified the above lines and ran the script, I had another error for contact.m.

Code: Select all

```
Subscripted assignment between dissimilar structures.
Error in contact (line 329)
S.refined(cr) = R;
```

Code: Select all

```
spherical: 1
uniform: 0
xi_rho: [1117×877 double]
eta_rho: [1117×877 double]
lon_rho: [1117×877 double]
lat_rho: [1117×877 double]
Irg_rho: [1117×877 double]
Jrg_rho: [1117×877 double]
xi_psi: [1116×876 double]
eta_psi: [1116×876 double]
lon_psi: [1116×876 double]
lat_psi: [1116×876 double]
Irg_psi: [1116×876 double]
Jrg_psi: [1116×876 double]
xi_u: [1116×877 double]
eta_u: [1116×877 double]
lon_u: [1116×877 double]
lat_u: [1116×877 double]
Irg_u: [1116×877 double]
Jrg_u: [1116×877 double]
xi_v: [1117×876 double]
eta_v: [1117×876 double]
lon_v: [1117×876 double]
lat_v: [1117×876 double]
Irg_v: [1117×876 double]
Jrg_v: [1117×876 double]
angle: [1117×877 double]
f: [1117×877 double]
h: [1117×877 double]
pm: [1117×877 double]
pn: [1117×877 double]
dndx: [1117×877 double]
dmde: [1117×877 double]
mask_rho: [1117×877 double]
mask_psi: [1116×876 double]
mask_u: [1116×877 double]
mask_v: [1117×876 double]
spherical: []
uniform: []
xi_rho: []
eta_rho: []
x_rho: []
y_rho: []
lon_rho: []
lat_rho: []
Irg_rho: []
Jrg_rho: []
xi_psi: []
eta_psi: []
x_psi: []
y_psi: []
lon_psi: []
lat_psi: []
Irg_psi: []
Jrg_psi: []
xi_u: []
eta_u: []
x_u: []
y_u: []
lon_u: []
lat_u: []
Irg_u: []
Jrg_u: []
xi_v: []
eta_v: []
x_v: []
y_v: []
lon_v: []
lat_v: []
Irg_v: []
Jrg_v: []
h: []
f: []
angle: []
pm: []
pn: []
dndx: []
dmde: []
mask_rho: []
mask_psi: []
mask_u: []
mask_v: []
```

I downloaded the Matlab routine today from

https://www.myroms.org/svn/src/matlab/grid/

Thanks in advance,

-DJ