Extracts bathymetry data from world-wide bathymetry databases.
Stores the latitude, longitude, and depth in spherical earth coordinates for faster interpolation within the WaveQ3D model. This choice of coordinates means that the latitude, longitude axes are actually stored in the form of a colatitude and azimuth in radians. Because these databases store their data such that latitudes area increasing, the co-latitude axis starts from it's largest value, and then uses a negative increment to sequence down to its smallest value. In other words, the data appear to be "upside-down" in spherical earth coordinates.
The variables to be loaded are deduced by their dimensionality. The first variable to have 2 dimensions is assumed to be depth. Negative depth values in netCDF file are taken to be underwater. Assumes that the dataset supports the COARDS conventions for the standardization of NetCDF files.
This may seem like a pretty loose specification, but this looseness is very helpful in automating the reading NetCDF files from a variety of sources.
Successfully tested using ETOPO1, ETOPO2, and ETOPO5 data:
netcdf_bathy | ( | const char * | filename, | |
double | south, | |||
double | north, | |||
double | west, | |||
double | east, | |||
double | earth_radius = wposition::earth_radius | |||
) |
Load bathymetry from disk.
Western hemisphere longitude can be expressed either as negative values or values above 180 degrees. Output longitudes use the same western hemisphere convention as input values. Exceptions to this logic happen in areas that span longitudes 0 and 180. Areas that span longitude 0 should use negative values for west and positive values for east. Areas that span longitude 180 should use positive values for both east and west.
filename | Name of the NetCDF file to load. | |
south | Lower limit for the latitude axis (degrees). | |
north | Upper limit for the latitude axis (degrees). | |
west | Lower limit for the longitude axis (degrees). | |
east | Upper limit for the longitude axis (degrees). | |
earth_radius | Local earth radius of curvature (meters). Set to zero if you want to make depths relative to earth's surface. |
std:invalid_argument | on invalid name or path of bathymetry file. |
void decode_filetype | ( | NcFile & | file, | |
NcVar ** | latitude, | |||
NcVar ** | longitude, | |||
NcVar ** | altitude | |||
) | [private] |
Deduces the variables to be loaded based on their dimensionality.
The first variable to have 2 dimensions is assumed to be depth. The 2 dimensions of the depth are assumed to be (in order) latitude and longitude in compliance with the COOARDS standards.
file | Reference to an open NetCDF file. | |
latitude | NetCDF variable for latitude (output). | |
longitude | NetCDF variable for longitude (output). | |
altitude | NetCDF variable for altitude (output). |