Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Sun Oct 22, 2017 9:16 pm




Post new topic Reply to topic  [ 20 posts ] 

All times are UTC

Author Message
PostPosted: Mon Feb 16, 2004 11:20 pm 
Offline
Site Admin
User avatar

Joined: Wed Feb 26, 2003 4:41 pm
Posts: 1012
Location: IMCS, Rutgers University
Dear All,

We fequently have questions about NetCDF and Matlab. In order to get NetCDF to work in Matlab, you need to intall the MEXCDF interface. For more information about MEXCDF, please visit the following link:

http://woodshole.er.usgs.gov/operations ... excdf.html

If you downloaded my Matlab directory tree which contains a great number of useful Matlab scripts,

http://www.myroms.org/software/Processi ... lab.tar.gz

you need to be careful with the MEX files since they can only be executed on a SUN computer running Solaris. On my computer, these executables have the .mexsol extension.

If you have a different computer architecture, you need to build the appropriate MEXCDF interface. To install the NetCDF toolbox for Matlab, follow the instructions given in:

http://woodshole.er.usgs.gov/staffpages ... c4ml5.html

The SeaGrid generation package also uses MEXCDF files to generate the model grid. It uses the mexinside, mexrec, and mexsepeli programs. You need to build these programs for your computer architecture. See the SeaGrid website for more information:

http://woodshole.er.usgs.gov/staffpages ... agrid.html

Good luck, Hernan


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 17, 2004 8:07 pm 
Offline

Joined: Mon Jun 07, 2004 7:56 pm
Posts: 1
Location: University of Wisconsin-Milwaukee
I run the upwelling/ downwelling example on a DEC Alpha machine. It generated the files ocean_avg.nc, ocean_dia.nc, ocean_his.nc, and ocean_rst.nc (and log).

I downloaded and installed MexCDF and NetCDF from the website http://woodshole.er.usgs.gov/staffpages ... c4ml5.html. They seem to run within Matlab, open a Net CDF Browser window, but give a couple of error messages about contour3 and feval.

Where can I find examples on the use of MexCDF and NetCDF to read a file (such as ocean_avg.nc, ocean_dia.nc, ocean_his.nc, and ocean_rst.nc) and prepare plots, such as those shown in the SCRUM manual (Figures 11-14)?

Thanks,


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 13, 2004 3:40 pm 
Hello all - this is my first post here and I have two questions regarding NetCDF

1) I ran the upwelling test case, and the ocean_his.nc, ocean_avg.nc, ocean_dia.nc, and ocean_rst.nc files are created fine. I can read them in using the ncload command (from the matlab.tar.gz file on this website), but cannot using MATLAB's own cdfread or cdfinfo commands. I thought NetCDF files were supposed to be all in the same format. This is more a curiousity question, as I said that I can read the files using ncload.

2) When I try to plot the results, using speed.m (also from the matlab.tar.gz file), I get errors regarding the missing gname (Grid NetCDF file name). This file is not created during runtime, and I assume that this is the file you create before running ROMS to set up the grid. For these test cases, what should one do (short of plotting the results on your own) to learn how to use the plotting functions, such as speed.m?

Thanks,
Michael


Top
  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 23, 2008 5:03 am 
I am a new user of ROMS. I installed ROMS in windows XP (via Cygwin). I am using MATLAB 7.1 in my pc. I have some quarry regarding seagrid download instructions mentioned on seagrid homepage.

I am not clear what does mean by “making sure preserve the subdirectory structure”. However, I download and install seagrid and find the directories and subdirectories mentioned on the instructions.

I need to know exactly what is Matlab path, however I added the complete seagrid folder into the toolbox of matlab

In matlab I type cd to the .\seagrid\test_data directory, then type "seagrid" and found the following comments:

## Unable to locate Mex-files. Please install
## "mexrect", "mexsepeli", and "mexinside",
## then adjust your Matlab path accordingly.

## SeaGrid requires the "Presto" toolbox.
## Please install and/or include in Matlab path.


Can anyone suggest, how to solve the problem?
Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 24, 2008 2:42 am 
Offline

Joined: Mon Dec 03, 2007 3:30 pm
Posts: 36
Location: Dalhousie University - Dept. of Oceanography
Hi Rouf,

I am new to ROMS too... but I may be able to help.

I think you need to install MEXNC for your matlab... I wrote a tutorial here: https://www.myroms.org/wiki/index.php/MEXNC

In step #5, I explained a bit how to add a directory to "Matlab's path".

I hope this helps.

Diego


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 24, 2008 9:01 am 
Thanks Diego.
I follow the instruction and installed MEXNC and SNCTOOLS but there is a problem with MATLAB toolkit installation.
After installing and extracting Matlab tool-kit, I added the directory to the MATLAB path and restart the Matlab. But it shows following comments

Warning: Name is nonexistent or not a directory: \home\arango\ocean\matlab\Damee.
> In path at 113
In startup at 14
In matlabrc at 220
Warning: Name is nonexistent or not a directory: \home\arango\ocean\matlab\coastlines.
> In path at 113
In startup at 15
In matlabrc at 220
Warning: Name is nonexistent or not a directory: \home\arango\ocean\matlab\dx.
> In path at 113
In startup at 16
In matlabrc at 220


…….. similar warning for all subdirectories (floats, forcing, grib, hydro, m_map, presto……) under matlab.

Is there anything wrong? Looking for your suggestion.

Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 24, 2008 2:43 pm 
Offline

Joined: Mon Dec 03, 2007 3:30 pm
Posts: 36
Location: Dalhousie University - Dept. of Oceanography
Hi Rouf,

In the matlab-toolkit that you just downloaded... there are ~28 directories and 1 file... startup.m

This startup.m file contains a script that adds the path of user-specified directories to Matlab's path... kind of an automatic alternative to the Add-path GUI that you used for MEXNC and SCTOOLS. The problem is that the startup.m file in the matlab-toolkit contains Hernan Arango's paths and NOT yours.

One way to fix this is to edit such startup.m file to reflect YOUR paths... find the following line (in startup.m):
Code:
my_root='/home/arango/ocean';

and replace '/home/arango/ocean' with YOUR path to the matlab toolkit.

Another solution (i think) is to delete the startup.m file that is creating the problem (since you already manually added the paths to MEXNC, SNCTOOL, etc )

Let me know what works for you... I may update the tutorial so that future users know what to do with the startup.m file.

Cheers!

Cheers


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 25, 2008 9:42 am 
Dear Diego
In terms of Matlab toolkit, I replace the root path in startup.m file but found similar problem and when I delete the startup.m, there is no warning.

My matlab version is 7.1.0.246 (R14) Service Pack 3. That’s why, I chooses the R14sp3 MEXNC version. Then follow the instruction accordingly. In matlab, when I type cd to the .\seagrid\test_data directory, then type "seagrid" But still the following error:

## Unable to locate Mex-files. Please install
## "mexrect", "mexsepeli", and "mexinside",
## then adjust your Matlab path accordingly.


I search the files in my downloaded Mexnc folder but there are no above named the files.
I also like to inform that my Matlab search path follow the following order: matlab tools, SNCTOOLS, Matlab\bin…Matlab\bin\win32, MEXNC………

So I need your help.
Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 25, 2008 1:37 pm 
Offline

Joined: Mon Dec 03, 2007 3:30 pm
Posts: 36
Location: Dalhousie University - Dept. of Oceanography
Hi Rouf,

Unfortunately I haven't work with Seagrid (I tried, but I also ran into troubles), so I won't be able to help a lot more on this :( ...Hernan said in the begining of this thread that
Quote:
It uses the mexinside, mexrec, and mexsepeli programs. You need to build these programs for your computer architecture. See the SeaGrid website for more information:

http://woodshole.er.usgs.gov/staffpages ... agrid.html


I can tell you already visit the website above and read the instructions. There it says to add the " appropriate
.\seagrid\mex_<version>_<os> directory to your matlab path. " . Since you are on a PC it looks like .\seagrid\mex is the appropriate directory to add to the path. If that doesn't work... you may have to compile the MEX files for your Matlab version from source code... tricky for us new users.

You may want to try https://www.myroms.org/wiki/index.php/easygrid

It is not nearly as powerful as seagrid, but it is easier to get up-and-running. I am still working on this tutorial, but it may be finished-enough to be helpful for you.

Back to seagrid... Perhaps a more advanced user can suggest Rouf how to fix his seagrid problem?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 27, 2008 10:56 am 
Sorry I did a mistake; I didn’t add the seagrid folders into Matlab path properly. Now I overcome the above-mentioned problem. Thanks Diego.

I am following Signell_seagrid tutorial. I extract, process and save the coast file and bathy file properly. My computer is also able to open the coast and bathy file properly in seagrid. But when I tried to make grid with 4 boundary points, I found following error in matlab

??? Invalid MEX-file 'C:\cygwin\seagrid\mex_matlab71_win32\mexrect.dll': Access is denied.

.

Error in ==> mexrect2grid at 98
zrect = feval('mexrect', zrect, length(zrect), ...

Error in ==> seagrid.gridcalc at 179
[w, err] = feval(theFcn, zti, [], ci, [m n]); % <Error> seagrid.dogrid at 64
gridcalc(self) % <Calculate> seagrid.doupdate at 92
dogrid(self, needsUpdate); % <== Step #2 <Error> seagrid.getboundary at 109
doupdate(self, 1)

Error in ==> seagrid.doevent at 129
getboundary(self, theCommand, theMessage)

Error in ==> psevent at 25
doevent(ps(gcbf), theEvent, theMessage);

??? Error while evaluating figure WindowButtonDownFcn.


can anyone help me to overcome the problem?

Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 28, 2008 1:00 am 
Offline
User avatar

Joined: Mon Apr 28, 2003 5:44 pm
Posts: 418
Location: Rutgers University
You should check the Matlab Release Notes:

Quote:
New File Extension for MEX-Files on Windows® Systems

MATLAB now uses the extension .mexw32 for MEX-files on 32-bit versions of Windows systems. In previous versions, MATLAB used the extension .dll.


I'd need to know your Matlab version to be sure, but I suspect you have a recent version that does not recognize the .dll files.

_________________
John Wilkin: IMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 30, 2008 3:39 am 
My Matlab version is 7.1. If I add mex_matlab71_win32 in the matlab path and try to make grid with 4 boundary points, it shows following error:
??? Invalid MEX-file 'C:\cygwin\seagrid\mex_matlab71_win32\mexrect.dll': Access is denied.

If I add mex_74_win32 in Matlab path it shows following
??? Invalid MEX-file 'C:\cygwin\seagrid\mex_matlab74_win32\mexrect.mexw32': Access is denied.


I need to know which mex_matlab??_win32 should I add with my Matlab path?

I check the Matlab Release Notes. I suspect (but not sure) that I have to recompile all MEX-files. There are lot of mex files here in Matlab. Is it mean I have to recompile all or only mexrect", mexsepeli, and mexinside?

I will be pleased if someone let me know details how to recompile the files in Matlab? Or any other way to overcome the problem as I am not sure wheather its a recompiling issue or not?

Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 30, 2008 12:36 pm 
Offline
User avatar

Joined: Mon Apr 28, 2003 5:44 pm
Posts: 418
Location: Rutgers University
The ROMS User forum might not be the best place to debug your Matlab problems, but let's try anyway:

What are the results of the following commands in your matlab environment:

>> version

>> which seagrid

>> seagrid('version')

>> which mexrect

>> test_mexrect

_________________
John Wilkin: IMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 01, 2008 1:02 am 
My Matlab environment results:

>> version

ans =

7.1.0.246 (R14) Service Pack 3

>> seagrid('version')
Version of 10-Aug-2001 14:37:19.



>> which mexrect
C:\cygwin\seagrid\mex_matlab74_win32\mexrect.mexw32

>> test_mexrect
??? Invalid MEX-file 'C:\cygwin\seagrid\mex_matlab74_win32\mexrect.mexw32': Access is denied.

.

Error in ==> test_mexrect at 35
z = mexrect ( z, np, n(1), n(2), n(3), n(4) );


Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Thu May 01, 2008 1:11 am 
Offline
User avatar

Joined: Mon Apr 28, 2003 5:44 pm
Posts: 418
Location: Rutgers University
You have Matlab version 7.1.0.246 (R14) Service Pack 3 so I believe you should be using the 'dll' mex file, not the mexw32.

Edit your matlabpath, verify with "which mexrect" that matlab finds the correct file, and try again with test_mexrect.

_________________
John Wilkin: IMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 01, 2008 9:30 am 
Thanks Wilkin. This time I use the dll mex file, edit my matlab path accordingly but following error:

>> cd mex_matlab71_win32

>> which mexrect
C:\cygwin\seagrid\mex_matlab71_win32\mexrect.dll

>> test_mexrect
??? Invalid MEX-file 'C:\cygwin\seagrid\mex_matlab71_win32\mexrect.dll': Access is denied.
.
Error in ==> test_mexrect at 35
z = mexrect ( z, np, n(1), n(2), n(3), n(4) );


Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Fri May 02, 2008 1:45 am 
Offline
User avatar

Joined: Mon Apr 28, 2003 5:44 pm
Posts: 418
Location: Rutgers University
I asked John Evans at The Mathworks about this, and he is as mystified as me. Here is his reply:

Quote:
Uhm, hmm, my first thought was that the user must be using an old mex-file,
because the 7.1 release is supposed to be using "*.mexw32" instead of "*.dll"
for an extension... but it looks like I was the one who built it as a *.dll
in the first place. Looking a bit further, it seems that dropping the dll
extension is strongly recommended, but not required for 7.1. It *should*
still work, though.

I went ahead and rebuilt the win32 mex-file for 7.1 (R14sp3) as having
the "*.mexw32" extention. It tests ok and is posted at the sourceforge site.
Tell the user to try it out.


So I suggest you try John's new mex files posted on sourceforge where you got the files before, and let us know what happens.

_________________
John Wilkin: IMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 02, 2008 7:52 am 
Yes its working now.
Many Thanks to Wilkin and John Evans.

Rouf


Top
  
Reply with quote  
 Post subject:
PostPosted: Sat May 03, 2008 12:06 am 
Dear Wilkin,

Ohhh ! there is one more error with my seagrid. Would you pls check the problem, I mentioned, in seagrid error under Roms tools and techniques thread?

Rouf


Top
  
Reply with quote  
PostPosted: Fri Jan 09, 2009 1:08 pm 
New from version R2008b, Matlab now supports its own netcdf api.
No need any more for Mexnc etc !
See http://www.mathworks.com/access/helpdes ... r9v-1.html


Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group