flopy.utils.observationfile module¶
-
class
HydmodObs
(filename, verbose=False, hydlbl_len=20)[source]¶ Bases:
flopy.utils.observationfile.ObsFiles
HydmodObs Class - used to read binary MODFLOW HYDMOD package output
Parameters: - filename (str) – Name of the hydmod output file
- verbose (boolean) – If true, print additional information to to the screen during the extraction. (default is False)
- hydlbl_len (int) – Length of hydmod labels. (default is 20)
Returns: Return type: None
-
class
Mf6Obs
(filename, verbose=False, isBinary=True)[source]¶ Bases:
flopy.utils.observationfile.ObsFiles
Mf6Obs Class - used to read ascii and binary MODFLOW6 observation output
Parameters: - filename (str) – Name of the hydmod output file
- verbose (boolean) – If true, print additional information to to the screen during the extraction. (default is False)
- hydlbl_len (int) – Length of hydmod labels. (default is 20)
Returns: Return type: None
-
class
ObsFiles
[source]¶ Bases:
flopy.utils.utils_def.FlopyBinaryData
-
get_data
(idx=None, obsname=None, totim=None)[source]¶ Get data from the observation file.
Parameters: - idx (int) – The zero-based record number. The first record is record 0. If idx is None and totim are None, data for all simulation times are returned. (default is None)
- obsname (string) – The name of the observation to return. If obsname is None, all observation data are returned. (default is None)
- totim (float) – The simulation time to return. If idx is None and totim are None, data for all simulation times are returned. (default is None)
Returns: data – Array has size (ntimes, nitems). totim is always returned. nitems is 2 if idx or obsname is not None or nobs+1.
Return type: numpy record array
Notes
If both idx and obsname are None, will return all of the observation data.
Examples
>>> hyd = HydmodObs("my_model.hyd") >>> ts = hyd.get_data()
-
get_dataframe
(start_datetime='1-1-1970', idx=None, obsname=None, totim=None, timeunit='D')[source]¶ Get pandas dataframe with the incremental and cumulative water budget items in the hydmod file.
Parameters: - start_datetime (str) – If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).
- idx (int) – The zero-based record number. The first record is record 0. If idx is None and totim are None, a dataframe with all simulation times is returned. (default is None)
- obsname (string) – The name of the observation to return. If obsname is None, all observation data are returned. (default is None)
- totim (float) – The simulation time to return. If idx is None and totim are None, a dataframe with all simulation times is returned. (default is None)
- timeunit (string) – time unit of the simulation time. Valid values are ‘S’econds, ‘M’inutes, ‘H’ours, ‘D’ays, ‘Y’ears. (default is ‘D’).
Returns: out – Pandas dataframe of selected data.
Return type: pandas dataframe
Notes
If both idx and obsname are None, will return all of the observation data as a dataframe.
Examples
>>> hyd = HydmodObs("my_model.hyd") >>> df = hyd.get_dataframes()
-
get_nobs
()[source]¶ Get the number of observations in the file
Returns: out – A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’. Return type: tuple of int
-
get_ntimes
()[source]¶ Get the number of times in the file
Returns: out – The number of simulation times (totim) in binary file. Return type: int
-
-
class
SwrObs
(filename, precision='double', verbose=False)[source]¶ Bases:
flopy.utils.observationfile.ObsFiles
Read binary SWR observations output from MODFLOW SWR Process observation files
Parameters: - filename (string) – Name of the cell budget file
- precision (string) – ‘single’ or ‘double’. Default is ‘double’.
- verbose (bool) – Write information to the screen. Default is False.
Notes
Examples
>>> import flopy >>> so = flopy.utils.SwrObs('mymodel.swr.obs')