def generic_asc2dem(name_in, name_out=None, quantity_name=None, use_cache=False, verbose=False): """Read raster from the following ASCII format (.asc) Generic function, created from asc2dem Example: ncols 3121 nrows 1800 xllcorner 722000 yllcorner 5893000 cellsize 25 NODATA_value -9999 138.3698 137.4194 136.5062 135.5558 .......... Convert name_in (.asc) to NetCDF format (.dem) mimicking the ASCII format closely. An accompanying file with same basename but extension .prj must exist and is used to fix the UTM zone, datum, false northings and eastings. The prj format is assumed to be as Projection UTM Zone 56 Datum WGS84 Zunits NO Units METERS Spheroid WGS84 Xshift 0.0000000000 Yshift 10000000.0000000000 Parameters """ kwargs = { 'name_out': name_out, 'quantity_name': quantity_name, 'verbose': verbose } if use_cache is True: from caching import cache result = cache(_generic_convert_dem_from_ascii2netcdf, name_in, kwargs, dependencies=[name_in, name_in[:-4] + '.prj'], verbose=verbose) else: result = apply(_generic_convert_dem_from_ascii2netcdf, [name_in], kwargs) return result
def generic_dem2pts( name_in, name_out=None, quantity_name=None, easting_min=None, easting_max=None, northing_min=None, northing_max=None, use_cache=False, verbose=False, ): """Read raster file from the following NetCDF format (.dem) Generic function, created from dem2pts Example: ncols 3121 nrows 1800 xllcorner 722000 yllcorner 5893000 cellsize 25 NODATA_value -9999 138.3698 137.4194 136.5062 135.5558 .......... name_in may be a .asc or .dem file to be converted. Convert to NetCDF pts format which is points: (Nx2) float array elevation: N float array """ kwargs = { 'name_out': name_out, 'quantity_name': quantity_name, 'easting_min': easting_min, 'easting_max': easting_max, 'northing_min': northing_min, 'northing_max': northing_max, 'verbose': verbose } if use_cache is True: from caching import cache result = cache(_generic_dem2pts, name_in, kwargs, dependencies=[name_in], verbose=verbose) else: result = apply(_generic_dem2pts, [name_in], kwargs) return result
def generic_dem2pts( self, name_in, name_out=None, quantity_name=None, easting_min=None, easting_max=None, northing_min=None, northing_max=None, use_cache=False, verbose=False, ): """Read raster file from the following NetCDF format (.dem) Generic function, created from dem2pts Example: ncols 3121 nrows 1800 xllcorner 722000 yllcorner 5893000 cellsize 25 NODATA_value -9999 138.3698 137.4194 136.5062 135.5558 .......... name_in may be a .asc or .dem file to be converted. Convert to NetCDF pts format which is points: (Nx2) float array elevation: N float array """ kwargs = { "name_out": name_out, "quantity_name": quantity_name, "easting_min": easting_min, "easting_max": easting_max, "northing_min": northing_min, "northing_max": northing_max, "verbose": verbose, } if use_cache is True: from caching import cache result = cache(self._generic_dem2pts, name_in, kwargs, dependencies=[name_in], verbose=verbose) else: result = apply(self._generic_dem2pts, [name_in], kwargs) return result
def generic_asc2dem(self, name_in, name_out=None, quantity_name=None, use_cache=False, verbose=False): """Read raster from the following ASCII format (.asc) Generic function, created from asc2dem Example: ncols 3121 nrows 1800 xllcorner 722000 yllcorner 5893000 cellsize 25 NODATA_value -9999 138.3698 137.4194 136.5062 135.5558 .......... Convert name_in (.asc) to NetCDF format (.dem) mimicking the ASCII format closely. An accompanying file with same basename but extension .prj must exist and is used to fix the UTM zone, datum, false northings and eastings. The prj format is assumed to be as Projection UTM Zone 56 Datum WGS84 Zunits NO Units METERS Spheroid WGS84 Xshift 0.0000000000 Yshift 10000000.0000000000 Parameters """ kwargs = {"name_out": name_out, "quantity_name": quantity_name, "verbose": verbose} if use_cache is True: from caching import cache result = cache( self._generic_convert_dem_from_ascii2netcdf, name_in, kwargs, dependencies=[name_in, name_in[:-4] + ".prj"], verbose=verbose, ) else: result = apply(self._generic_convert_dem_from_ascii2netcdf, [name_in], kwargs) return result
def generic_dem2npy(self, name_in, name_out=None, quantity_name=None, easting_min=None, easting_max=None, northing_min=None, northing_max=None, use_cache=False, verbose=False,): """ Read raster file from the following NetCDF format (.dem) Generic function, created from dem2npy Example: ncols 3121 nrows 1800 xllcorner 722000 yllcorner 5893000 cellsize 25 NODATA_value -9999 138.3698 137.4194 136.5062 135.5558 .......... name_in may be a .asc or .dem file to be converted. Convert to numpy array which is points: (Nx3) float array """ kwargs = {'name_out': name_out, 'quantity_name': quantity_name, 'easting_min': easting_min, 'easting_max': easting_max, 'northing_min': northing_min, 'northing_max': northing_max, 'verbose': verbose} if use_cache is True: from caching import cache result = cache(self._generic_dem2npy, name_in, kwargs, dependencies = [name_in], verbose = verbose) else: result = apply(self._generic_dem2npy, [name_in], kwargs) return result