Conversation
|
Issues
======
- Added 29
Complexity increasing per file
==============================
- py_openda/py_openda/costFunctions/CsvStochObserver.py 2
- py_openda/py_openda/algorithms/ensemble_kalman.py 3
- py_openda/py_openda/costFunctions/LorenzStochModelFactory.py 8
- py_openda/py_openda/costFunctions/GenericEnsembleKalmanFilter.py 4
- py_openda/py_openda/costFunctions/JObjects.py 6
- py_openda/py_openda/costFunctions/LorenzStochModelInstance.py 8
- py_openda/py_openda/utils/py4j_utils.py 5
- py_openda/examples/py_kalman/enkf_swan.py 4
Clones added
============
- py_openda/py_openda/costFunctions/JObjects.py 1
- py_openda/py_openda/costFunctions/LorenzStochModelInstance.py 1
See the complete overview on Codacy |
|
|
||
| TODO: java observation description maken! | ||
|
|
||
| * `get_observation_descriptions(self)` returns the observation descriptions that the model instance can use to determine which elements of the state vector corresponds to quantities that are observed. Keep in mind that there is no utility routine for creating a java observation description from python, so for now you cannot combine a python observer with a java model. |
There was a problem hiding this comment.
|
|
||
| * `get_observations(self, descriptions)` returns values of the state vector that correspond to the given observation descriptions. These descriptions are given by the stoch observer, so pay special attention when trying to use them. | ||
|
|
||
| * `update_state(self, state_array, main_or_ens)` changes the state vector based on the input `state_array`. Note that the input is a little different depending on whether the model to be updated is an ensemble member or the main model. For an ensemblemember `state_array` should be added to the state vector, while for the main model it is supposed to replace the state vector. This is controlled by the `main_or_ens` argument, which is a string equal to either "main" or "ens". |
There was a problem hiding this comment.
|
|
||
| TODO: Misschien leuk om init ook met alleen een xml file als input te doen? | ||
|
|
||
| * `__init__(self, config=None, scriptdir=None)` initializes the object. Here `config` is the stochObserver element of the main `.oda` configuration file as a dictionary. `scriptdir` is the directory containing the `.oda` file. |
There was a problem hiding this comment.
| """ | ||
| ``` | ||
|
|
||
| * `__init__(self, config, scriptdir)` initializes the object. Here `config` is the stochModelFactory element of the main `.oda` configuration file as a dictionary. `scriptdir` is the directory containing the `.oda` file. |
There was a problem hiding this comment.
| observer_config_xml = config.get('configFile') | ||
| self.observer = None | ||
| observer_object = 'gateway.jvm.'+config.get('@className') | ||
| exec('self.observer =%s()' % observer_object) |
| """ | ||
| (self.param, self.param_uncertainty, self.state, self.state_uncertainty, self.sys_mean, | ||
| self.sys_std, self.span) = model_attributes | ||
|
|
| model_config_xml = config.get('configFile') | ||
| self.model_factory = None | ||
| model_object = 'gateway.jvm.'+config.get('@className') | ||
| exec('self.model_factory =%s()' % model_object) |
| """ | ||
| ``` | ||
|
|
||
| * `get_time_horizon(self)` should return a time object spanning the start and end of the simulation. |
There was a problem hiding this comment.
|
|
||
| * `get_observation_descriptions(self)` returns the observation descriptions that the model instance can use to determine which elements of the state vector corresponds to quantities that are observed. Keep in mind that there is no utility routine for creating a java observation description from python, so for now you cannot combine a python observer with a java model. | ||
|
|
||
| * `get_sqrt_covariance(self)` generates an np array representing the squared covariance matrix. Note that you first have to convert the output yourself. For this you can use the utility routine `j_vector_array_to_np_array(j_sqrt)` if you have a java vector array. |
There was a problem hiding this comment.
|
|
||
| * `compute(self, time)` runs the model until the given time. | ||
|
|
||
| * `get_observations(self, descriptions)` returns values of the state vector that correspond to the given observation descriptions. These descriptions are given by the stoch observer, so pay special attention when trying to use them. |
There was a problem hiding this comment.
|
|
||
| * `get_time_horizon(self)` should return a time object spanning the start and end of the simulation. | ||
|
|
||
| * `get_current_time(self)` returns the time up to which the state vector has been calculated. |
There was a problem hiding this comment.
| noise_config = {'@stochParameter':False, '@stochForcing':False, '@stochInit':False} | ||
| elif main_or_ens == "ens": | ||
| noise_config = {'@stochParameter':False, '@stochForcing':True, '@stochInit':True} | ||
|
|
| """ | ||
| return self.current_time | ||
|
|
||
| def announce_observed_values(self, descriptions): |
| observer_config_xml = config.get('configFile') | ||
| self.observer = None | ||
| observer_object = 'gateway.jvm.'+config.get('@className') | ||
| exec('self.observer =%s()' % observer_object) |
| @@ -0,0 +1,182 @@ | |||
| ## Using the main program | |||
There was a problem hiding this comment.
| elif isinstance(obj, np.ndarray): | ||
| obj = obj.squeeze().tolist() | ||
| elif isinstance(obj, list): | ||
| None |
There was a problem hiding this comment.
Issue found: Statement seems to have no effect
|
|
||
| * `get_sqrt_covariance(self)` generates an np array representing the squared covariance matrix. Note that you first have to convert the output yourself. For this you can use the utility routine `j_vector_array_to_np_array(j_sqrt)` if you have a java vector array. | ||
|
|
||
| * `get_realizations(self)` creates realizations of the observed values using the mean and the standarddeviation of the measurement. The output will be converted automatically. |
There was a problem hiding this comment.
| from setuptools import setup, find_packages | ||
| with open("README.txt", 'r') as f: | ||
| long_description = f.read() | ||
|
|
| # ensembleModel@stochParameter=false | ||
| # ensembleModel@stochForcing=true | ||
| # ensembleModel@stochInit=true | ||
|
|
|
|
||
| * `get_current_time(self)` returns the time up to which the state vector has been calculated. | ||
|
|
||
| * `announce_observed_values(self, descriptions)` function which can be used to make sure that the model will save the observations described by the descriptions. This function does get called by the main algorithm, but it does not have to do anything if your implementation does not need it to. |
There was a problem hiding this comment.
|
|
||
| * `get_times(self)` lists all the times where there are observations available. The output will automatically be converted to a python list of time objects. | ||
|
|
||
| * `get_count(self)` simply returns an integer indicating the number of measurements available. |
There was a problem hiding this comment.
|
|
||
| * `__init__(self, config=None, scriptdir=None)` initializes the object. Here `config` is the stochObserver element of the main `.oda` configuration file as a dictionary. `scriptdir` is the directory containing the `.oda` file. | ||
|
|
||
| * `create_selection(self, model_span)` creates a new stoch observer, limited to the span given by the time object `model_span`. The class of the output should be the same as the class of `self`. |
There was a problem hiding this comment.
| model_config_xml = config.get('configFile') | ||
| self.model_factory = None | ||
| model_object = 'gateway.jvm.'+config.get('@className') | ||
| exec('self.model_factory =%s()' % model_object) |
| :param descriptions: an ObservationDescriptions object with meta data for the observations. | ||
| :return: | ||
| """ | ||
| None |
There was a problem hiding this comment.
Issue found: Statement seems to have no effect
| * `get_observation_descriptions(self)` returns the observation descriptions that the model instance can use to determine which elements of the state vector corresponds to quantities that are observed. Keep in mind that there is no utility routine for creating a java observation description from python, so for now you cannot combine a python observer with a java model. | ||
|
|
||
| * `get_sqrt_covariance(self)` generates an np array representing the squared covariance matrix. Note that you first have to convert the output yourself. For this you can use the utility routine `j_vector_array_to_np_array(j_sqrt)` if you have a java vector array. | ||
|
|
There was a problem hiding this comment.
No description provided.