Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Tue Jul 23, 2019 8:43 pm




Post new topic Reply to topic  [ 21 posts ] 

All times are UTC

Author Message
PostPosted: Thu Oct 25, 2018 11:06 am 
Offline

Joined: Mon Mar 12, 2018 2:19 pm
Posts: 6
Location: Meteorology and Oceanology Institution of NUDT
Hi, I am a beginner to ROMS learning, I have tried many ROMS grid generation tools, such as Seagrid easygrid and GridBuilder.

Seagrid and easygrid tools have not been updated for a long time, so when I use them in matlab, I always encounter many errors.
I have been using the GridBuilder tool. But it can't be opened sporadically.
so I want to know if there is a up-to-date grid generation tool or what is the wide-used tool to create ROMS grid?


Thanks for your attention and your reply.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 31, 2018 11:48 pm 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
GridBuilder is now available as a Matlab Toolbox (.mltbx) including source code from John Luick's Austides site (http://austides.com/downloads). Once installed, it should run from the command line under any recent version of Matlab. If you are having problems with program please let me know the specifics including any error messages you are getting.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 14, 2019 3:10 am 
Offline

Joined: Sat Aug 26, 2017 12:59 am
Posts: 2
Location: Tsinghua University
Hi Charles

I am a new GridBuilder user. I use an old coarse grid generated by seagrid to get a fine subgrid by GridBuilder. Then problems show up when I try to generate a contact file using the ROMS function 'contact'. The error message is:

Reference to non-existent field 'contact'.
Error in grid_connections (line 635)
dg = S.contact(cr).donor_grid;
Error in contact (line 312)
S = grid_connections(G, S);

Then if the coarse and fine grids are both generated by Gridbuilder, errors also happen during generation of a contact file:
undefined function or variable 'FCr'.
Error in contact>refine_coordinates (line 721)
FSr.Values = G(dg).angle(:); R.angle = FCr(XrF, YrF);
Error in contact>refinement (line 1512)
R = refine_coordinates (cr, dg, rg, G, S, MaskInterp);
error contact (line 327)
[P, R] = refinement (cr, dg, rg, Lmask, G, S, MaskInterp);

Thanks, Victor

CharlesJames wrote:
GridBuilder is now available as a Matlab Toolbox (.mltbx) including source code from John Luick's Austides site (http://austides.com/downloads). Once installed, it should run from the command line under any recent version of Matlab. If you are having problems with program please let me know the specifics including any error messages you are getting.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 14, 2019 4:24 am 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
Hi Victor,

Unfortunately I haven't added support for creating multiple nested grids into GruidBuilder since I've only done off-line nesting. For now you'll have to add the nesting attributes manually to the attributes in the new grid to use contact.m. I'll look into it for the next time I update the program. If I know the parent grid, I should be able to compute the refinement attributes and the contact file at the same time but I'll need to learn more about the process to be able to test the generated grids.

cheers,


Charles


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 14, 2019 7:23 am 
Offline

Joined: Tue May 01, 2018 3:56 pm
Posts: 41
Location: Tsinghua
CharlesJames wrote:
Hi Victor,

Unfortunately I haven't added support for creating multiple nested grids into GruidBuilder since I've only done off-line nesting. For now you'll have to add the nesting attributes manually to the attributes in the new grid to use contact.m. I'll look into it for the next time I update the program. If I know the parent grid, I should be able to compute the refinement attributes and the contact file at the same time but I'll need to learn more about the process to be able to test the generated grids.

cheers,


Charles


Hi Charles,

I am also a new user. I wonder that if I can just set the corner in the map your provide? I wanna use the exact value(for example 10°N 10°E) as the gird corner, but I did not find that function. Thank you and look for your reply.

Peida


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 14, 2019 11:52 pm 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
Hi Peida,

It sounds like being able to specify exact corner coordinates would be a useful feature to add, I'll try and put something together. In the meantime you can import custom reference points in a text file as comma deliminated x,y pairs. These points will plot as small black + symbols on the map at the exact points specified. By creating a free format grid, you can then drag each corner over one of the fixed reference points, by repeating this and zooming in on the corners you can get arbitrarily close to the exact coordinate but I realize it would be somewhat tedious to get it down to double precision accuracy.

I'll take the last two questions as suggestions and see if I can fit in another update later this year.

thanks,
CJ


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 15, 2019 8:48 am 
Offline

Joined: Tue May 01, 2018 3:56 pm
Posts: 41
Location: Tsinghua
CharlesJames wrote:
Hi Peida,

It sounds like being able to specify exact corner coordinates would be a useful feature to add, I'll try and put something together. In the meantime you can import custom reference points in a text file as comma deliminated x,y pairs. These points will plot as small black + symbols on the map at the exact points specified. By creating a free format grid, you can then drag each corner over one of the fixed reference points, by repeating this and zooming in on the corners you can get arbitrarily close to the exact coordinate but I realize it would be somewhat tedious to get it down to double precision accuracy.

I'll take the last two questions as suggestions and see if I can fit in another update later this year.

thanks,
CJ



Hi Charles,

Thank you for your reply. And I find another way to specify exact corner coordinates: I use Matlab to generate a nc.file containing the lon and lat data, then I open this file in Gridbuilder.

Thanks again,
Peida


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 21, 2019 6:44 am 
Offline

Joined: Sat Aug 26, 2017 12:59 am
Posts: 2
Location: Tsinghua University
CharlesJames wrote:
Hi Victor,

Unfortunately I haven't added support for creating multiple nested grids into GruidBuilder since I've only done off-line nesting. For now you'll have to add the nesting attributes manually to the attributes in the new grid to use contact.m. I'll look into it for the next time I update the program. If I know the parent grid, I should be able to compute the refinement attributes and the contact file at the same time but I'll need to learn more about the process to be able to test the generated grids.

cheers,


Charles


Hi Charles

Many thanks for your answer. The GridBuilder is a nice tool and we are looking forward to its update.

Regards, Victor


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 22, 2019 4:56 am 
Offline
User avatar

Joined: Mon May 05, 2003 2:41 pm
Posts: 122
Location: The University of Western Australia, Perth, Australia
Just adding comment when Sasa is not going to ;)

I find extremely useful Alex's tool for generating curvlinear orthogonality error free grids and suggest you to have a look at the older posts:

viewtopic.php?f=23&t=3878&p=14908

and

viewtopic.php?f=14&t=4775&p=18530#p18530

It is easy to create grid and the gird is of high quality (i.e. ortho error ~0)

p.s. there are other packages as well (based on Pavel Sakov's gridgen) that can make amazing grids as well (just google).

Cheers
I.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 09, 2019 10:18 am 
Offline

Joined: Thu Mar 08, 2018 2:47 am
Posts: 68
Location: German Research Centre for Geosciences
Hi all,

I am trying to "replace" the topography in an existing ROMS grid file. But when I load the grid file into GridBuilder I get the error:

Code:
Error using griddedInterpolant
Grid is improperly defined.

Error in setROMSgrid (line 59)
BathyInterpolant=griddedInterpolant(bathymetry.xbathy,bathymetry.ybathy,bathymetry.zbathy,'linear','none');

Error in GridBuilderCallbacks (line 74)
                setROMSgrid(SG);

Error in GridBuilder>mImROMS_Callback (line 440)
GridBuilderCallbacks(hObject,eventdata,handles)

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in GridBuilder (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GridBuilder('mImROMS_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback.


My grid is an Arctic grid, i.e. it has a pole in it. I don't know if that poses a problem to GridBuilder. The grid I am using has not been generated by me. I could investigate it further but "improperly" is quite a vague statement.

Thanks for any hints or help!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 10, 2019 3:28 am 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
Hi,

I haven't tested GridBuilder or ROMS with a polar grid before, the error message is from Matlab's griddedInterpolant routine which usually wants a ndgrid type x,y coordinate so it may be my routines for reading in topography with a pole in it are falling over a bit, if the routine didn't get the x,y into a suitable configuration that would cause a problem. If you can send me a copy of the grid and topography i can see what is required to read it in correctly. Assuming I can fix it easily, that will add a nice new capability to the program.

Charles


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 11, 2019 9:35 am 
Offline

Joined: Thu Mar 08, 2018 2:47 am
Posts: 68
Location: German Research Centre for Geosciences
Hi Charles,

I sent you an email with the files. In the meanwhile, I will try myself to find a solution, too.

Cheers,
Cate


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 11, 2019 3:59 pm 
Offline

Joined: Thu Mar 08, 2018 2:47 am
Posts: 68
Location: German Research Centre for Geosciences
Okay, I managed to load my grid file into gridBuilder by adding these two lines to the getDefaultBathymetry function:

Code:
if axlim(1)<-180;axlim(1)=-180;end
if axlim(2)>180;axlim(2)=180;end


By remapping my new topography to the old grid file grid and writing a simple script to load lon_rho, lat_rho and z into a respective .mat file (containing xbathy, ybathy and zbathy), I also managed to replace the topography and export an actual grid. What's still disturbing is a seam between min and max lon. I guess, I'll have to modify my input topography accordingly. But for now I am happy to at least have a new grid file for first simulation attempts. :)

Looking forward to hearing your opinion on my rudimentary fix! :lol:


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 12, 2019 5:43 am 
Offline

Joined: Wed Oct 01, 2014 8:57 pm
Posts: 59
Location: Tokyo Institute of Technology
After looking through recent posts in this thread, I thought I'd try posting about some grid generation related issues I've been having. Though I've tried using Gridbuilder a few times before, it's only this week that I really started using it for an application I'm setting up. It works great for the most part, and I find it to be very useful for creating regional scale grids. I've been trying to create a finer scale grid though, for a domain 4 km x 2 km, and a grid cell size of approximately 50 meters, and I've been having some difficulty as the program really slows down or even stops working whenever I try to translate or adjust the size of the grid through the corner points. I've tried using both the standalone version as well as the Matlab toolbox, but I encounter the same situation. Is this a known issue for Gridbuilder?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 12, 2019 10:41 pm 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
It is interesting that both these issues seem to relate to getDefaultBathymetry which is used to open the ETOPO2 default and extract topography for the region, this might not always be necessary if the user has imported their own topography first but it is still called and kept in reserve to fill in gaps if the domain is moved around outside the imported topography limits. Both grids are fairly extreme examples of domains, one is very, very small, the other is probably 360 degrees in longitude, and I think that is what is triggering these bugs. In the very small domain I don't think it is the 50m resolution that is the problem (I can do that fairly easily with a larger domain) but the size of the domain itself. For 4km x 2km ETOPO2 may have fewer that two depth points which means the griddedInterpolant routine will not work - I'll modify the code to maintain a minimum of decent number of points in an array regardless of domain size, that should keep it from falling over. I assume you will be importing much higher resolution topography and coastline, ETOPO2 is no use at 50m. For the polar example, I'm sorry I didn't get the grid file in my email, if the file is too large it may not have gotten through my work address, we have fairly low limits on attachments, perhaps you can post it on the forum or send me a dropbox link to it. I'm assuming the grid will be rectangular with +90 as the upper boundary and periodic BC at +/-180 is that right? The fix that Cate came up with suggests the function can't handle the fact that there are two boundaries at +/- 180 that are effectively the same longitude, the fact that you are getting a seam in the data suggests that the topography at one of the boundaries is being lost, I'll have a look at that and see if I can write that to handle the special case of "around the world" grids, it will be relevant for other models like that as well. Thanks for the feed back, I'll post here when I've got a fix.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 15, 2019 5:55 am 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
I've made a small fix to getDefaultBathymetry.m which is hopefully attached, if too few eTOPO points are found in the model domain this should ensure that the nearest array of depths that include the model domain are still returned. I'm not sure if this will help with the polar grid yet I'll have to do some more testing. If this works ok I'll include it in the next update.


Attachments:
File comment: This modified getDefaultBathymetry file should ensure there is always at least a 2x2 array of eTOPO topography regardless of domain size.
getDefaultBathymetry.m [3.67 KiB]
Downloaded 5 times
Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 15, 2019 9:26 am 
Offline

Joined: Thu Mar 08, 2018 2:47 am
Posts: 68
Location: German Research Centre for Geosciences
Hi Charles,

I attached the grid file and the topography (remapped to the grid file's grid). I included your fix into getDefaultBathymetry but unfortunately this didn't solve the problem so I still had to add the lines for axlim(1) and axlim(2).
I appreciate if you try and find a solution for the polar application but no need to hurry. :)

I have one more question: When creating a new mask from topography, does GridBuilder use the loaded topography or the ETOPO? Thank you!

//Cate


Attachments:
A20_topo_Miocene.nc [917.39 KiB]
Downloaded 6 times
A20_grd_openBering_double.nc [6.84 MiB]
Downloaded 4 times
Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 16, 2019 3:14 am 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
OK, I see what you have now, it is a rectangular grid but includes the north pole so the gridbuilder default projection is very distorted and the sides are not calculated correctly. To allow gridbuilder to manipulate this grid or others like it I'd need to add a sterographic projection to allow grids like yours to appear rectangular and get the boundaries and topography right.

The problems loading the default topography were due to expanding the domain by 10% on each boundary to ensure enough eTOPO bathymetry was included for small grids, since I shifted this task to the getDefaultBathymetry program this isn't required anymore. It was causing a problem with grids that run from -180 to 180 since it created domains that were more than 360 degrees wide and eTOPO couldn't provide topography for that. Your fix worked fine as it restored the proper limits within the function, but by eliminating the domain expansion that problem shouldn't crop up again. I've attached a new setROMSgrid routine that fixes this if used in conjuction with the previous getDefaultBathymetry file I posted - I'll try and get an update including both these fixes up as soon as possible.

GridBuilder uses the user topography for masking if topography based masking is selected, but I don't think the topography in your example will be correctly mapped in Spherical coordiates so you may not get the results you want.

I've had requests before for stereographic projections so maybe it's time to look at integrating it like the Cartesian/Spherical selection - this may take a bit of time though since there are a lot of dependent functions to update.


Attachments:
File comment: remove expansion of domain for eTopo bathymetry - now handled in getDefaultBathymetry.
setROMSgrid.m [3.01 KiB]
Downloaded 8 times
Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 16, 2019 5:24 am 
Offline

Joined: Wed Oct 01, 2014 8:57 pm
Posts: 59
Location: Tokyo Institute of Technology
CharlesJames wrote:
I've made a small fix to getDefaultBathymetry.m which is hopefully attached, if too few eTOPO points are found in the model domain this should ensure that the nearest array of depths that include the model domain are still returned. I'm not sure if this will help with the polar grid yet I'll have to do some more testing. If this works ok I'll include it in the next update.


Hi Charles,

Thank you for your explanation, and for this fix in getDefaultBathymetry.m. I'll give it a try and see if I still have the issues I mentioned previously. But you are right of course, I intend to input my own higher resolution bathymetry and coastline for the modeling grid I am setting up. I'll give you some feedback once I'm successfully able to do so.

Lawrence


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 19, 2019 5:42 am 
Offline

Joined: Wed Oct 01, 2014 8:57 pm
Posts: 59
Location: Tokyo Institute of Technology
Hi Charles,

I'd just like to share that I've been able to use GridBuilder for my relatively small domain without any issues after using the updated getDefaultBathymetry.m I'm finding though that the default coastline even at highest resolution seems to have some mismatch with some commonly used tools, particularly Google Earth. But I guess this is not much of a problem since the software allows for user created coastlines and bathymetry, which I've been able to successfully use for my domain.

You mentioned that the griddedInterpolant function in Matlab is used to interpolate the bathymetry. I could probably have a closer look at the code, but even so I'd like to ask which interpolation and extrapolation methods are used, and if they can be changed (and would it be advisable to do so). Thank you as always for your efforts in developing this tool.

Lawrence


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 19, 2019 7:11 am 
Offline
User avatar

Joined: Thu May 24, 2007 12:12 pm
Posts: 26
Location: South Australian Research and Development Institute
The coastlines are the latest GSHHG coastline polygons which are GWS84 but even at full resolution they will be coarser than your grid - not sure why Google Maps would be different but the Google map elements might be higher resolution or they may use a different datum.

I use the interpolants to speed up bathymetry calculations when grids are manipulated, eTOPO comes on a regular grid so griddedInterpolant works well and quickly, if a user supplies bathymetry on a regular grid we use griddedInterpolant for that too but if the bathymetry is on scattered or curvilinear points then you have to use scatteredInterpolant which is slower and sensitive to grid spacing.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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:  
Powered by phpBB® Forum Software © phpBB Group