flopy.mf6.utils.mfobservation module

class MFObservation(mfdict, path, key)[source]

Bases: object

Wrapper class to request the MFObservation object: Class is called by the MFSimulation.SimulationDict() class and is not called by the user

mfdict: (dict) the sim.simulation_dict.mfdict object for the flopy project path: (object) the path object detailing model names and paths key: (tuple, stings) user supplied dictionary key to request observation utility data

Returns: ——– self.data: (xarray) array of observations

class MFObservationRequester(mfdict, path, key, **kwargs)[source]

Bases: object

Wrapper class for MFObservation.Observations. Class checks which observation data is available, and creates a dictionary key to access the set of observation data from the SimulationDict()

static getkeys(mfdict, path)[source]
class Observations(fi)[source]

Bases: object

Simple class to extract and view Observation files for Uzf models (possibly all obs/hobs)?

fi = (sting) name of the observation binary output file

get_data(): (np.array) returns array of observation data
text = (str) specific modflow record name contained in Obs.out file idx = (int), (slice(start, stop)) integer or slice of data to be returned. corresponds to kstp*kper - 1 totim = (float) model time value to return data from

list_records(): prints a list of all valid record names contained within the Obs.out file get_times(): (list) returns list of time values contained in Obs.out get_nrecords(): (int) returns number of records get_ntimes(): (int) returns number of times get_nobs(): (int) returns total number of observations (ntimes * nrecords)

get_data(key=None, idx=None, totim=None)[source]

Method to request and return array of data from an Observation output file

Parameters:
  • key ((str) dictionary key for a specific observation contained within) – the observation file (optional)
  • idx ((int) time index (optional)) –
  • totim ((float) simulation time (optional)) –
Returns:

data

Return type:

(list) observation file data in list

get_dataframe(keys=None, idx=None, totim=None, start_datetime=None, timeunit='D')[source]

Creates a pandas dataframe object from the observation data, useful backend if the user does not like the x-array format!

Parameters:
  • keys ((string) sting of dictionary/observation keys separated by comma.) – (optional)
  • idx ((int) time index location (optional)) –
  • totim ((float) simulation time (optional)) –
  • start_datetime ((string) format is 'dd/mm/yyyy' or) – ‘dd/mm/yyyy hh:mm:ss’ (optional)
  • timeunit ((string) specifies the time unit associated with totim when) – setting a datetime
Returns:

Return type:

pd.DataFrame

get_nobs()[source]
get_nrecords()[source]
get_ntimes()[source]
get_obs_data(key=None, idx=None, totim=None)[source]

Method to request observation output data as an x-array :param key: within the observation file (optional) :type key: (string) dictionary key for a specific observation contained :param idx: :type idx: (int) time index (optional) :param totim: :type totim: (float) simulation time (optional)

Returns:xarray.DataArray
Return type:(NxN) dimensions are totim, header == keys*
get_times()[source]
list_records()[source]
try_float(data)[source]