Ejemplo n.º 1
0
    def write_lat_lon(self, lat_lon_data, out_file, x=0, y=0, z=0):
        """Write the lat/lon data to a ParFlow simple ascii formatted file

        Parameters
        ----------
        lat_lon_data : ndarray
            lat/lon data in formatted 1d array
        out_file : str
            path and name for output file
        x : int
            size of x dimension (Default value = 0)
        y : int
            size of y dimension (Default value = 0)
        z : int
            size of z dimension (Default value = 0)

        Returns
        -------
        None

        """
        file_io_tools.write_array_to_text_file(out_file=out_file,
                                               data=lat_lon_data,
                                               fmt='%s',
                                               header=f'{x} {y} {z}')
Ejemplo n.º 2
0
    def write_land_cover(self, land_cover_data, out_file):
        """Write the land cover file in vegm format

        Parameters
        ----------
        land_cover_data : ndarray
            formatted vegm data (2d array)
        out_file : str
            path and name to write output

        Returns
        -------
        None
        """
        heading = "x y lat lon sand clay color fractional coverage of grid, by vegetation class (Must/Should Add to " \
                  "1.0) "
        col_names = [
            '', '', '(Deg)', '(Deg)', '(%/100)', '', 'index', '1', '2', '3',
            '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
            '16', '17', '18'
        ]
        header = '\n'.join([heading, ' '.join(col_names)])
        file_io_tools.write_array_to_text_file(out_file=out_file,
                                               data=land_cover_data,
                                               header=header,
                                               fmt=['%d'] * 2 + ['%.6f'] * 2 +
                                               ['%.2f'] * 2 + ['%d'] * 19)