Hi,
I have a model grid from years ago. And I need to generate a child grid and the corresponding contact netcdf file. The problem is the old model grid that I have is not created from the rutgers/grid tools. So when I use coarse2fine.m, it is not working. Can someone show me how to deal with this?
Best,
Amy
How to generate contact netcdf?
Re: How to generate contact netcdf?
what exactly is the problem? do you get an error message?
the commands would be something like this:
ref_ratio=3;
roms_child_grid='Sandy_roms_grid_ref3.nc';
F=coarse2fine('Sandy_roms_grid.nc','Sandy_roms_grid_ref3.nc', ...
ref_ratio,Istr,Iend,Jstr,Jend);
Gnames={'Sandy_roms_grid.nc','Sandy_roms_grid_ref3.nc'};
[S,G]=contact(Gnames,'Sandy_roms_contact.nc');
where Istr,Iend, Jstr, Jend are the indices of the parent grid that define where the child should be.
-j
the commands would be something like this:
ref_ratio=3;
roms_child_grid='Sandy_roms_grid_ref3.nc';
F=coarse2fine('Sandy_roms_grid.nc','Sandy_roms_grid_ref3.nc', ...
ref_ratio,Istr,Iend,Jstr,Jend);
Gnames={'Sandy_roms_grid.nc','Sandy_roms_grid_ref3.nc'};
[S,G]=contact(Gnames,'Sandy_roms_contact.nc');
where Istr,Iend, Jstr, Jend are the indices of the parent grid that define where the child should be.
-j
Re: How to generate contact netcdf?
Problems we have seen with other users starting from old grids is that the parent grid is missing the psi points coordinates.
You may need to add the psi points if they are absent because the grid subsetting is defined in terms of the psi-points corners.
If you need a Matlab function to compute the psi points coordinates (and mask) from the rho points I can send you one.
You may need to add the psi points if they are absent because the grid subsetting is defined in terms of the psi-points corners.
If you need a Matlab function to compute the psi points coordinates (and mask) from the rho points I can send you one.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: How to generate contact netcdf?
I used the exact same code:
Ginp is my parent grid and Gout is my output child grid.
This is my error message:
Code: Select all
F=coarse2fine(Ginp,Gout,Gfactor,163,190,217,240);
This is my error message:
Code: Select all
Error using netcdflib
The NetCDF library encountered an error during execution of 'getVaraDouble' function -
'Index exceeds dimension bound (NC_EINVALCOORDS)'.
Error in netcdf.getVar (line 136)
data = netcdflib(funcstr,ncid,varid,varargin{:});
Error in nc_read>nc_read_matlab (line 397)
f = netcdf.getVar(ncid, varid, start, count);
Error in nc_read (line 95)
f = nc_read_matlab(ncfile,Vname,Tindex,ReplaceValue,PreserveType,Info);
Error in coarse2fine (line 552)
C.hraw = nc_read(Ginp,'hraw',1);
Error in childGrd_forSFB (line 4)
F=coarse2fine(Ginp,Gout,Gfactor,163,190,217,240);
Re: How to generate contact netcdf?
Psi points? Do you mean lon_psi, lat_psi, mask_psi, x_psi, y_psi? My parent grid has all of these...
Thank you all for your prompt response!!! I really appreciate it!
Thank you all for your prompt response!!! I really appreciate it!
Re: How to generate contact netcdf?
I have created a child grid using the method that I had been using, which works fine for old version ROMS and COAWST. But the new model needs contact.nc. So initially, I tried this
My error message shows that
So I have done some searches on the forum and found out that if I am using some other packages to create child grid, it is lack of some information that is needed for creating the contact.nc. That is why I tried to use coarse2fine.m to generate a new child grid.
Best,
Amy
Code: Select all
name = 'contact.nc';
c_contact(name,true,2)
grd = {'parent_grd.nc','child_grd.nc'};
[S,G]=contact(grd,name);
Code: Select all
Contact Donor Receiver
Region Grid Grid
Reference to non-existent field 'contact'.
Error in contact (line 316)
dg = S.contact(cr).donor_grid;
Best,
Amy
Re: How to generate contact netcdf?
I have figured out my problem and successfully created the contact.nc. Moving on to run the model and test my grid setting!
Re: How to generate contact netcdf?
Will you share what you did to solve the issue? I have been through the exact same steps as you and have also encountered this error message.
Thanks,
David
Thanks,
David