Esempio n. 1
0
    def output_filepath(self, name, item='temp'):
        """Get ArcGIS data path.

        TODO: item needs to be set for each raster 
        reparatelly. Now all is in temp dir.

        :param name: layer name

        :return: full path
        """
        #try:
        #    item = self._data[name]
        #except:
        #    item = 'temp'

        path = os.path.join(Globals.get_outdir(), item, 'data.gdb', name)
        Logger.debug('File path: {}'.format(path))

        return path
Esempio n. 2
0
def rillCalculations(sur,
                     pixelArea,
                     l,
                     rillRatio,
                     n,
                     slope,
                     delta_t,
                     ratio,
                     ppp=False):

    raw_input()
    h_rill = sur.h_rill
    b = sur.rillWidth
    V_to_rill = h_rill * pixelArea
    sur.V_to_rill = V_to_rill

    b_tmp = b
    courant = courantMax + 1.0

    while (courant > courantMax):

        b = b_tmp
        # if sur.state != 2 :
        # b = 0

        # print '\t', b,
        b, V_rill_runoff, V_rill_rest, q, v, courant = rill(
            V_to_rill, rillRatio, l, b, delta_t, ratio, n, slope, pixelArea,
            ppp)
        # if ppp :
        ### print '\t', b, V_rill_runoff, V_rill_rest, courant
        if (courant > courantMax):
            Logger.debug('------ ratio += 1 -----')
            raw_input()
            ratio += 1
            if (ratio > 10):
                return b_tmp, V_to_rill, V_rill_runoff, V_rill_rest, 0.0, 0.0, 11, courant

    qMax = max(q)
    vMax = max(v)
    # print raw_input('..')
    # print "V_to_rill, V_rill_runoff", V_to_rill, V_rill_runoff
    return b, V_to_rill, V_rill_runoff, V_rill_rest, qMax, vMax, ratio, courant
Esempio n. 3
0
    def _load_data(filename):
        """Load data from pickle.

        :param str filename: file to be loaded
        """
        if filename is None:
            raise ProviderError('Input file for loading data not defined')
        with open(filename, 'rb') as fd:
            if sys.version_info > (3, 0):
                data = pickle.load(fd, encoding='bytes')
                data = {
                    key.decode(): val.decode if isinstance(val, bytes) else val
                    for key, val in data.items()
                }
            else:
                data = pickle.load(fd)
        Logger.debug('Size of loaded data is {} bytes'.format(
            sys.getsizeof(data)))

        return data
Esempio n. 4
0
 def __del__(self):
     for fd in self.files:
         Logger.debug('Hydrographs file "{}" closed'.format(fd.name))
         fd.close()