How to generate contact netcdf?

Discussion of how to use ROMS on different regional and basin scale applications.

Moderators: arango, robertson

Post Reply
Message
Author
txu68
Posts: 27
Joined: Wed Nov 11, 2015 4:49 pm
Location: Georgia Institute of Technology

How to generate contact netcdf?

#1 Unread post by txu68 »

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

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: How to generate contact netcdf?

#2 Unread post by jcwarner »

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

User avatar
wilkin
Posts: 875
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: How to generate contact netcdf?

#3 Unread post by wilkin »

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.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

txu68
Posts: 27
Joined: Wed Nov 11, 2015 4:49 pm
Location: Georgia Institute of Technology

Re: How to generate contact netcdf?

#4 Unread post by txu68 »

I used the exact same code:

Code: Select all

F=coarse2fine(Ginp,Gout,Gfactor,163,190,217,240); 
Ginp is my parent grid and Gout is my output child grid.

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);

txu68
Posts: 27
Joined: Wed Nov 11, 2015 4:49 pm
Location: Georgia Institute of Technology

Re: How to generate contact netcdf?

#5 Unread post by txu68 »

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!

txu68
Posts: 27
Joined: Wed Nov 11, 2015 4:49 pm
Location: Georgia Institute of Technology

Re: How to generate contact netcdf?

#6 Unread post by txu68 »

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

Code: Select all

name = 'contact.nc';
c_contact(name,true,2)

grd = {'parent_grd.nc','child_grd.nc'};
[S,G]=contact(grd,name);
My error message shows that

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; 
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

txu68
Posts: 27
Joined: Wed Nov 11, 2015 4:49 pm
Location: Georgia Institute of Technology

Re: How to generate contact netcdf?

#7 Unread post by txu68 »

I have figured out my problem and successfully created the contact.nc. Moving on to run the model and test my grid setting!

undave
Posts: 11
Joined: Mon Jul 16, 2007 5:30 pm
Location: Florida Gulf Coast University

Re: How to generate contact netcdf?

#8 Unread post by undave »

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

Post Reply