hydromt.io.open_mfcsv#

hydromt.io.open_mfcsv(paths: Dict[str | int, str | Path], concat_dim: str, *, driver_kwargs: Dict[str, Any] | None = None, variable_axis: Literal[0, 1] = 1, segmented_by: Literal['id', 'var'] = 'id') Dataset[source]#

Open multiple csv files as single Dataset.

Parameters:
  • paths (Dict[str | int, str | Path],) – Dictionary containing a id -> filename mapping. Here the ids, should correspond to the values of the concat_dim dimension and the corresponding setting of segmented_by. I.e. if files are segmented by id, these should contain ids. If the files are segmented by var, the keys of this dictionaires should be the names of the variables.

  • concat_dim (str,) – name of the dimension that will be created by concatinating all of the supplied csv files.

  • driver_kwargs (Dict[str, Any],) – Any additional arguments to be passed to pandas’ read_csv function.

  • variable_axis (Literal[0, 1] = 1,) – The axis along which your variables or ids are. so if the csvs have the columns as variable names, you would leave this as 1. If the variables are along the index, set this to 0. If you are unsure leave it as default.

  • segmented_by (str) – How the csv files are segmented. Options are “id” or “var”. “id” should refer to the values of concat_dim. Segmented by id means csv files contain all variables for one id. Segmented by var or contain all ids for a single variable.

Returns:

data – The newly created Dataset.

Return type:

Dataset