I'm a newbie with working in ROMS. I tried the venerable Emmanuel Dilorenzo's intro course and was stuck with using some of his RNT toolkit (especially rnt_timectl - datenum issue). I decided to test the shipped matlab routine provided https://www.myroms.org/wiki/Matlab_Scripts but I was greeted with an error when I tried to used the d_script to create an initial condition.
Unrecognized function or variable 'mexnc'.
Error in c_initial (line 157)
[ncid,status]=mexnc('create',ncname,'clobber');
I suspect this has to do with the use of mexnc interface but my version of matlab is 2019b so I don't know why the native interface isn't used.Or is the mexnc supposed to be manaully compiled before I use it?
function [varargout] = mexnc ( varargin )
% MEXNC is a gateway to the netCDF interface. To use this function, you
% should be familiar with the information about netCDF contained in the
% "User's Guide for netCDF". This documentation may be obtained from
% Unidata at
% <http://my.unidata.ucar.edu/content/software/netcdf/docs.html>.
%
% R2008b and Beyond
% -----------------
% Starting with R2008b, MATLAB comes with native netCDF support. If
% your version of MATLAB is earlier than R2008b, mexnc will use it's own
% mex-file. If MATLAB is R2008b or higher, mexnc will use MATLAB's
% native package by default.
With 2019b the function becomes a wrapper to the native netcdf toolbox. You won't need the actually compiled mex code, but you still need the wrapper. It was done in this way to maintain backward compatibility.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Interesting. I can't even find the mexnc() script you provided. A linux recursive find command return empty search result. I just updated/checkout the latest version of the matlab script and still the same issue.
Reading the src of c_initial.m it seem there is a delibrate use of mexnc() in the definition of the dimension. This is case for all dimension definition used throughout the script. It isn't clear to me where the use of the native interface netcdf.open or nccreate is used in the file.
Yes, I updated c_initial.m, c_climatology.m, and c_biology.m to use the native Matlab interface to NetCDF. I have been removing slowly the old and obsolete interface to mexnc. Please update your repository. Thank for reporting this issue.
Perfect!!. Updated the repo and it work now. Thanks Hernan and John. Really appreciate your time.
Guess the only issue now remains using RNT Toolbox error (rnt_timectl). I understand that's a seperate issue as the scripts are third-party to the ROMS official script. In any case, I can always work with the main support matlab script.
Hi, I'm getting a similar behavior with the c_boundary.m function. If I understood it correctly, the script doesn't use the native NetCDF interface, when the mexnc() function is called, right? Because c_boundary.m creates the NetCDF file still with mexnc().