function ok = plotAscGrid(varargin) %plotAscGrid plot the extend of an Arc ASCII Grid Format file and its grids % % The function is able to plot: % 1 - the extend of the ASCII grid % 2 - the extend of the ASCII grid + the grid cell at the lower left % corner % 3 - all grid cells % % Syntax: % Untitled(varargin) % % Input: % plotAscGrid = the sets of Arc ASCII files + information [{set1},{set2},..] % Each set: asc-filename % line-setting (for instance ':r' for a dotted red % line) % % Output: % ok = "ok" not any problem % "..." any other message, something went wrong % % Example % % See also %% Copyright notice % -------------------------------------------------------------------- % Copyright (C) 2011 Deltares % Lou Verhage % % lou.verhage@deltares.nl % % Deltares % P.O. Box 177 % 2600MH Delft % Tel: +31 (0)88 335 8273 % % Visiting adress: % Rotterdamseweg 185 % 2629 HD Delft % Tel: +31 (0)88 335 8276 % % This library is free software: you can redistribute it and/or % modify it under the terms of the GNU Lesser General Public % License as published by the Free Software Foundation, either % version 2.1 of the License, or (at your option) any later version. % % This library is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % Lesser General Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with this library. If not, see . % -------------------------------------------------------------------- % This tool is part of OpenEarthTools. % OpenEarthTools is an online collaboration to share and manage data and % programming tools in an open source, version controlled environment. % Sign up to recieve regular updates of this function, and to contribute % your own tools. %% Version % Created: 06 Jan 2011 % Created with Matlab version: 7.6.0.324 (R2008a) % $Id: $ % $Date: $ % $Author: $ % $Revision: $ % $HeadURL: $ % $Keywords: $ %% Initialize ok = 'yes'; if nargin > 0 for n = 1 : nargin v = varargin(n); v = v{1}; fileName{n} = v{1}; cl{n} = v{2}; end else ok = 'not any input argument'; return end %% computation legendText = ''; for nrSet = 1 : length(fileName) % in ArcGisread the next options are set and must be overruled %OPT.export = 1; % export plot %OPT.mat = 1; % save as mat D = ArcGisRead(fileName(nrSet),'export',0,'mat',0); % legendText(nrSet) = fileName(nrSet); xx=[D.x(1);D.x(D.ncols);D.x(D.ncols);D.x(1);D.x(1)]; yy=[D.y(1);D.y(1);D.y(D.nrows);D.y(D.nrows);D.y(1)]; plot(xx,yy,cl{nrSet}); hold on grid on axis equal end fileName=strrep(fileName,'_','\_'); legend(fileName,'location','best');