# Changes between Version 8 and Version 9 of ModellingQuestions

Ignore:
Timestamp:
Oct 20, 2008, 1:54:45 PM (15 years ago)
Comment:

--

Unmodified
Added
Removed
Modified
• ## ModellingQuestions

 v8 as determined by the user. == How can I combine data sets? == A user may have access to a range of different resolution DEMs and raw data points (such as beach profiles, spot heights, single or multi-beam data etc) and will need to combine them to create an overall elevation data set. If there are multiple DEMs, say of 10m and 25m resolution, then the technique is similar to that defined in the Cairns example described earlier, that is: {{{ convert_dem_from_ascii2netcdf(10m_dem_name, use_cache=True, verbose=True) convert_dem_from_ascii2netcdf(25m_dem_name, use_cache=True, verbose=True) }}} followed by: {{{ dem2pts(10m_dem_name, use_cache=True, verbose=True) dem2pts(25m_dem_name, use_cache=True, verbose=True) }}} These data sets can now be combined by {{{ from anuga.geospatial_data.geospatial_data import * G1 = Geospatial_data(file_name = 10m_dem_name + '.pts') G2 = Geospatial_data(file_name = 25m_dem_name + '.pts') G = G1 + G2 G.export_points_file(combined_dem_name + ï¿½.ptsï¿½) }}} This is the basic way of combining data sets, however, the user will need to assess the boundaries of each data set and whether they overlap. For example, consider if the 10m DEM is describing by {{{poly1}}} and the 25m DEM is described by {{{poly2}}} with {{{poly1}}} completely enclosed in {{{poly2}}} as shown here: \begin{figure}[hbt] \centerline{\includegraphics{graphics/polyanddata.jpg}} \caption{Polygons describing the extent of the 10m and 25m DEM.} \label{fig:polydata} \end{figure} To combine the data sets, the geospatial addition is updated to {{{ G = G1 + G2.clip_outside(Geospatial_data(poly1)) }}} For this example, we assume that {{{poly2}}} is the domain, otherwise an additional dataset would be required for the remainder of the domain. This technique can be expanded to handle point data sets as well. In the case of a bathymetry data set available in text format in an {{{.csv}}} file, then the geospatial addition is updated to {{{ G3 = Geospatial_data(file_name = bathy_data_name + '.csv') G = G1 + G2.clip_outside(Geospatial_data(poly1)) + G3 }}} The {{{.csv}}} file has the data stored as {{{x,y,elevation}} with the text {{{elevation}}} on the first line. The coastline could be included as part of the clipping polygon to separate the offshore and onshore datasets if required. Assume that {{{poly1}}} crosses the coastline In this case, two new polygons could be created out of {{{poly1}}} which uses the coastline as the divider. As shown in Figure \ref{fig:polycoast}, {{{poly3}}} describes the onshore data and {{{poly4}}} describes the offshore data. \begin{figure}[hbt] \centerline{\includegraphics{graphics/polyanddata2.jpg}} \caption{Inclusion of new polygons separating the 10m DEM area into an onshore (poly3) and offshore (poly4) data set.} \label{fig:polycoast} \end{figure} Let's include the bathymetry data described above, so to combine the datasets in this case, {{{ G = G1.clip(Geospatial_data(poly3)) + G2.clip_outside(Geospatial_data(poly1)) + G3 }}} Finally, to fit the elevation data to the mesh, the script is adjusted in this way {{{ domain.set_quantity('elevation', filename = combined_dem_name + '.pts', use_cache = True, verbose = True) }}}