Regridding input data to higher resolution

The initial resolution of the input file is used as the higher resolution that Badlands model can used. If one started with a given resolution and want to work with an higher one, it is required to regrid the input file to match at least the requested resolution.


In [1]:
import sys
print(sys.version)
print(sys.executable)


2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609]
/usr/bin/python2

In [2]:
%matplotlib inline

# Import badlands grid generation toolbox
import pybadlands_companion.resizeInput as resize

1. Load python class and set required resolution


In [3]:
#help(resize.resizeInput.__init__)

In [6]:
newRes = resize.resizeInput(requestedSpacing = 40)

2. Regrid DEM file


In [7]:
#help(newRes.regridDEM)
newRes.regridDEM(inDEM='mountain/data/nodes.csv',outDEM='mountain/data/newnodes.csv')


Data spacing:  0.4
Requested spacing:  400
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-71d75b606641> in <module>()
      1 #help(newRes.regridDEM)
----> 2 newRes.regridDEM(inDEM='mountain/data/nodes.csv',outDEM='mountain/data/newnodes.csv')

/home/danial/pyBadlands-Companion/pybadlands_companion/resizeInput.pyc in regridDEM(self, inDEM, outDEM)
     75             print 'Data spacing: ',self.dx
     76             print 'Requested spacing: ',self.res
---> 77             raise ValueError('The requested resolution is lower than the existing one.')
     78         self.Y = xyz.values[:,1]
     79 

ValueError: The requested resolution is lower than the existing one.

3. Regrid Rain file


In [ ]:
#help(newRes.regridRain)
newRes.regridRain(inRain='data/rain.csv',outRain='newrain.csv')

4. Regrid Tectonic files

Here you have the choice between vertical only displacements file and 3D ones.

In cases where you have several files you might create a loop to automatically regrid the files!

Vertical only file


In [ ]:
#help(newRes.regridTecto)
newRes.regridTecto(inTec='data/disp.csv', outTec='newdisp.csv')

3D displacements file


In [ ]:
#help(newRes.regridDisp)
newRes.regridDisp(inDisp='data/disp.csv', outDisp='newdisp.csv')

In [ ]: