function vdm_altitude_test(filename, bathy, output)


fid = fopen(filename, 'rt');
fidOut = fopen(output, 'wt');
token = sprintf('\t');
lat = nc_varget(bathy, 'latitude');
lon = nc_varget(bathy, 'longitude');

fprintf(fidOut, '# VARS value - expected values\n');
fprintf(fidOut, '# dAltitude\tdLongitude\tdLatitude\n');
while ~feof(fid)
    line = fgetl(fid);

        datum.depth = str2double(stringtokenizer(line, 2, token));
        datum.latitude = str2double(stringtokenizer(line, 3, token));
        datum.longitude = str2double(stringtokenizer(line, 4, token));
        datum.altitude = str2double(stringtokenizer(line, 5, token));

        if ~isempty(datum.latitude)
            iy = near(lat, datum.latitude);
            ix = near(lon, datum.longitude);
            
            nix = ix - 1; % NEtcdf are 0 based indices
            niy = iy - 1; % NEtcdf are 0 based indices
            z = nc_varget(bathy, 'elevation', [niy, nix] , [1 1]);
            
            % def altitude = -dem.getZ(lon, lat) - depths[i] // dem is -
            % down, depth is + down
            a = -z - datum.depth;
            
            da = datum.altitude - a;
            dlat = datum.latitude - lat(iy);
            dlon = datum.longitude - lon(ix);
            
            fprintf(fidOut, '%f\t%f\t%f\n', da, dlat, dlon);
        end

end
fclose(fid);
fclose(fidOut);
