bug message reminder

When adressing a model crash or bug, please remember to include an entire model setup in your post that reproduces the crash or exposes the bug. Also add the XBlog.txt file. This is necessary information for people that are trying to help you. Including your model setup can be achieved by adding the zipped run directory (excluding output) as an attachment to the post.

Forum

Error following tutorial - 2D setup

SM
Samantha Maticka, modified 6 Years ago.

Error following tutorial - 2D setup

Capillary Posts: 4 Join Date: 10/7/13 Recent Posts
Hi there,

I'm a new user of XBeach - really excited to get up to speed with its capabilities, but I have hit a few bumps that I'm hoping someone can help me with.

I received an error while following the tutorial 'Setting up your model > Going 2D with your model.' I'll say what I did and then paste the error here.

What I did:
After running oetsettings('quiet'), I retrieved the x, y, and z variables from the url (copy and pasted the code from tutorial). Then I copy and paste the generate command

i.e.
>>xbm = xb_generate_model( ...
'bathy', {'x', x, 'y', y, 'z', z ...
'crop', [100110 530440 7333 5817], ...
'finalise', {'lateral_sandwalls' 'lateral_extend' 'seaward_flatten'} ...
} ...
);

What MATLAB had to say:
(1) after running oetsettings('quiet') I get this warning:

Warning: Invalid file or directory
'C:\Users\smaticka\Documents\MATLAB\XBeach\xbeach_release_10May2013\io\netcdf\netcdfAll-4.2.jar'.
> In javaclasspath>local_validate_dynamic_path at 274
In javaclasspath>local_javapath at 182
In javaclasspath at 119
In javaaddpath at 71
In netcdf_settings at 109
In oetsettings at 154

(2) After generating the model (aforementioned code), I get a warning followed by an error:

Warning: INTERP2 cannot be used,
interpolation can take a little longer:
Input grid is not a valid MESHGRID.
> In xb_grid_optimize at 257
In xb_generate_bathy at 156
In xb_generate_model at 128
Warning: INTERP2 cannot be used,
interpolation can take a little longer:
Input grid is not a valid MESHGRID.
> In xb_grid_optimize at 338
In xb_generate_bathy at 156
In xb_generate_model at 128
Error using setproperty (line 206)
Second argument inputCell must be a cell
containing a single struct or
property/value pairs

Error in xb_grid_finalise (line 110)
OPT = setproperty(OPT, varargin);

Error in xb_grid_optimize (line 423)
[xgrid, ygrid, zgrid] =
xb_grid_finalise(xgrid, ygrid, zgrid,
OPT.finalise{:});

Error in xb_generate_bathy (line 156)
[x y z ne alpha xori yori] =
xb_grid_optimize( ...

Error in xb_generate_model (line 128)
bathy = xb_generate_bathy(OPT.bathy{:});

After reading through previous discussions, the warning seemed to be a result of non-monotonic bathymetry, but I presume the tutorial data should meet the restrictions of the model?

Thank you so much!
JD
Joost den Bieman, modified 6 Years ago.

RE: Error following tutorial - 2D setup (Answer)

Wind Posts: 96 Join Date: 9/21/12 Recent Posts
Hi Samantha,

Firstly, welcome to the XBeach community!

(1) It seems like we forgot to include a few files necessary for working with NetCDF files (one of the file formats XBeach uses for its output files) in the release of our Matlab toolbox. I'll try to fix it in a new release of the toolbox.

In the meantime, you could get the complete OpenEarth toolbox in subversion, in which the necessary NetCDF files are already included (this also allows you to keep the XBeach toolbox up-to-date, since all updates/fixes to the are downloaded). To do so, follow the instructions on this page.

(2) The last error you mention is caused by a change in the function call of xb_grid_finalise, which is not yet accounted for in the tutorial (I'll make sure this gets fixed soon!). The correct syntax now would be:

xbm = xb_generate_model( ...
    'bathy', {'x', x, 'y', y, 'z', z ...
        'crop', [100110 530440 7333 5817], ...
        'finalise', {'actions',{'lateral_sandwalls' 'lateral_extend' 'seaward_flatten'}} ...
    } ...
);


So the 'actions' performed by the xb_grid_finalise function need to be put into a structure first, and then inputted as a keyword-value style input parameter.

If you have any more questions regarding XBeach or downloading the Matlab toolbox, don't hesitate to ask.

Happy Modelling,

Cheers, Joost
SM
Samantha Maticka, modified 6 Years ago.

RE: Error following tutorial - 2D setup

Capillary Posts: 4 Join Date: 10/7/13 Recent Posts
Hi Joost,

Thank you for your reply! I now have the complete toolbox through OpenEarth, with the regular pre-compiled XBeach executable.

I altered the 'xb_generate_model' inputs per your suggestions. I no longer receive errors, but I am still getting warnings:

Warning: INTERP2 cannot be used, interpolation can take a
little longer: Input grid is not a valid MESHGRID.
> In xb_grid_optimize at 273
In xb_generate_bathy at 156
In xb_generate_model at 134
Warning: INTERP2 cannot be used, interpolation can take a
little longer: Input grid is not a valid MESHGRID.
> In xb_grid_optimize at 359
In xb_generate_bathy at 156
In xb_generate_model at 134

I have a few questions:
(1) Is it possible that I do not have the most de-bugged version of XBeach?
(2) The environment I am interested in simulating consists of a steep shelf meeting a lagoon. There will be a steep decrease in depth, followed by shallow flat region, followed by a increase in depth to a constant lagoon depth. I am wondering if I will be able to meet the restrictions on monotonic bathymetric changes in the pre-compiled version.

Thank you!
Sam
JD
Joost den Bieman, modified 6 Years ago.

RE: Error following tutorial - 2D setup

Wind Posts: 96 Join Date: 9/21/12 Recent Posts
Hi Samantha,

As for the warnings, that is nothing to worry about, just an indication that interpolation can take a bit longer than expected.

1). I'm not sure which version of XBeach you have now, but I would recommend to download the latest daily build here

2). XBeach should be able to handle these situations, be it at the price of a slightly increased grid resolution. I'm not sure how the Matlab toolbox will handle the grid creation and optimization, so be sure to double check the resulting model grid.

Cheers, Joost

P.S. be aware that the toolbox tries to recognise the coastline orientation and rotate your bathymetry accordingly. This can give problems for strongly curved coastlines (for example). This can be solved by supplying a rotation angle in the 'rotate' argument (part of the 'bathy' arguments)