Hi ROMS community,
I'm a new user in ROMS and I'm currently working on setting up an idealized grid for the ROMS model using MATLAB and have run into a bit of a roadblock. I'm trying to save the grid structure to a NetCDF file, as required by ROMS.
On the ROMS wiki [https://www.myroms.org/wiki/Grid_Processing_Scripts], I found the "write_contact.m" function (the last function on this website), but it seems to be designed for nested grids, and mine is not.
Here's the matlab function:
write_contact(ncname, S, Lcreate)
Writes out the nested grids contact points data generated by contact.m or read_contact.m into a NetCDF.
Since my grid isn't nested, I'm wondering if there's a different approach or function to save the grid structure to a NetCDF file in MATLAB.
Any guidance or suggestions would be highly appreciated. Thanks a bunch!
Need Help Saving Idealized Grid Structure to NetCDF File in MATLAB
-
- Posts: 30
- Joined: Fri Dec 15, 2017 6:07 pm
Re: Need Help Saving Idealized Grid Structure to NetCDF File in MATLAB
The function is c_grid.m. The function takes the following as arguments on input:
%
% Lp Number of RHO-points in the XI-direction
% Mp Number of RHO-points in the ETA-direction
% Gname Grid NetCDF file name (string)
% NewFile Switch to create a new file (logical, OPTIONAL)
% spherical Spherical grid switch (default true)
Write_contact.m is for creating a contact file between two or more nested grids.
%
% Lp Number of RHO-points in the XI-direction
% Mp Number of RHO-points in the ETA-direction
% Gname Grid NetCDF file name (string)
% NewFile Switch to create a new file (logical, OPTIONAL)
% spherical Spherical grid switch (default true)
Write_contact.m is for creating a contact file between two or more nested grids.
Re: Need Help Saving Idealized Grid Structure to NetCDF File in MATLAB
Thanks a lot for your prompt reply! I truly appreciate your assistance.
Your suggestion to use c_grid for creating a new grid was helpful. Now, I have a follow-up question. If I make changes to specific parameters, such as f, mask_v, or lon_rho these kind of variables, within the grid structure, how can I save these modifications back into the NetCDF file?
I'm eager to learn more and your guidance has been invaluable.
Thanks again
Your suggestion to use c_grid for creating a new grid was helpful. Now, I have a follow-up question. If I make changes to specific parameters, such as f, mask_v, or lon_rho these kind of variables, within the grid structure, how can I save these modifications back into the NetCDF file?
I'm eager to learn more and your guidance has been invaluable.
Thanks again
-
- Posts: 30
- Joined: Fri Dec 15, 2017 6:07 pm
Re: Need Help Saving Idealized Grid Structure to NetCDF File in MATLAB
If you have made changes to variables you can use the inbuilt function of matlab (nwrite) itself to store them in the existing variable of the netcdf file.
Re: Need Help Saving Idealized Grid Structure to NetCDF File in MATLAB
Got it! Thank you for your guidance!