|Matlab Scripts Menu|
|2. 4D-Var Observations Scripts|
|3. Bathymetry Scripts|
|4. Lateral Boundary Conditions Scripts|
|5. Coastline Extraction Scripts|
|6. Grid Processing Scripts|
|7. Initial Conditions and Climatology Scripts|
|8. Land/Sea Masking Scripts|
|9. NetCDF Data Processing Scripts|
|10. SeaGrid Generation Scripts|
|11. Seawater Properties Scripts|
|12. Utility Scripts|
These pages describe a variety of Matlab scripts that can be used for pre-processing and post-processing ROMS data. Since all the data in ROMS is managed with NetCDF files, some of these scripts use a NetCDF interface to Matlab to process the data. There are several interfaces for Matlab available from third parties. The most widely used interfaces are MEXNC and SNCTOOLS.
However, starting with Matlab version 2012a, released on Feb 9, 2012, the native interface to NetCDF is the preferred method for processing NetCDF data in the scripts distributed in the ROMS repository matlab and described here. The native interface was introduced in Matlab version 2008b for NetCDF-3 type files. The NetCDF-4 support started in version 2010b. The support for HDF5 files was completed in version 2011a. The OpenDAP support began in version 2012a. If your Matlab version is older than 2008b, we highly recommend that you update to the newest version. However, in the basic generic scripts we have switches for older versions to activate either the MEXNC interface for standard NetCDF files and the SNCTOOLS interface to process NetCDF files on an OpenDAP server.
Programming in Matlab is easy. However, good and efficient programming in Matlab requires skill and time. We usually become better at it the more that we practice. I started programming in Matlab in the earlier 1990's. If I look back at my earlier scripts, they were horrendous and extremely inefficient. There were some scripts that would take around 30 minutes to execute. I can rewrite those scripts nowadays and it will take seconds to execute. So we learn over the years how to program very efficiently. We are constantly learning new tricks and new functions. Just like ROMS, Matlab is always evolving. Plotting in Matlab also takes skill. There are a lot of papers in the literature with very poor Matlab plots...
To check-out the scripts described here from the ROMS repository matlab, enter:
svn checkout https://www.myroms.org/svn/src/matlab MyDir
where MyDir is the destination directory on your local computer. It will be created if not found. If your username on your local computer is not the same as your ROMS username you will need to pass the --username option to svn:
svn checkout --username joe_roms https://www.myroms.org/svn/src/matlab MyDir
Although not necessary nowadays, the MEXNC interface can be downloaded from:
svn checkout https://mexcdf.svn.sourceforge.net/svnroot/mexcdf/mexnc/trunk MyDir
and the SNCTOOLS interface can be downloaded from:
svn checkout https://mexcdf.svn.sourceforge.net/svnroot/mexcdf/snctools/trunk MyDir
But recall that both the MEXNC and SNCTOOLS interfaces are obsolete if you have Matlab Version 2008b or newer and Matlab Version 2012a for accessing NetCDF files on an OpenDAP server. See description in the above.
The ROMS matlab repository has the following structure:
matlab/ Main directory /4dvar 4D-Var observations processing scripts /bathymetry ROMS Grid bathymetry extraction and processing scripts /bin Repository processing .bash and .sh scripts /boundary Lateral boundary conditions processing scripts /coastlines Coastline extraction scripts /initial Initial conditions and climatology processing scripts /landmask Land/Sea masking processing scripts and GUIs /mex/ MEX interface to C and Fortran programs /mexinside inside program /mexrect Curvilinear and rectilinear program /mexsepeli Sepeli conformal mapping /netcdf NetCDF data processing scripts /seagrid SeaGrid generation GUI /seawater Seawater properties scripts /utility Miscellaneous all purpose scripts /startup.m User script for configuring Matlab
The mexinside program is kind of obsolete since Matlab offers inpolygon with the same functionality.