Some memory free-ing
Deallocates arrays in the RT code, and hence frees memory
Run the fwd model
Run the adjoint model
Return a limits list that doesn’t contain zero in the step term. (if it is zero, it is set to 1e-20, i.e. a small number)
Need to develop a new demo
Dequantize a value by limits and return the unquantized value.
This is redundant
return an x_model representation which has parameter values for the complete model grid. The array x_obs has a representation of the parameter values only for observation points, whereas x_model is typically defined over the whole assimilation period/region.
When loading parameters in this way (from observation space to model space, only the parameter associated with the first observation at a particular point is taken (summer=False)
When loading derivatives (e.g. when using the adjoint) we need to sum over all observation grid points (summer=True)
x_obs : array-like
x_model : array-like
Access and set up critical elements of the problem.
Write the parameters out to filename
A method to extend the state vector definition by e.g. making each state have a value per waveband. This is useful for non spectral models (e.g. MODIS kernels)
Inputs: op : a ParamStorage containing ‘x’ fromList: what the states were previously called toList : what we will call them now
For a list liner, return a float representation of the value in column index, or 0 if the len(index) is zero.
A very useful utility method to get a full list of potential filenames.
datadir= : list of directories to search in env=None : environment variable to give a colon (:)
separated string to provide a list of directories to search in
The filename fname is first expanded to take account of ~ or other symbols.
If the resultant filename is an absolute filename (i.e. starts with ‘/’ on Unix or related on windows, and it is confirmed to be a file, and is readable, then only this filename is returned.
If the fname is absolute, but it is not a file, then the basename of fname is assumed to be what the user wanted to refer to as fname. The basename is the second half of what is returned by split(fname).
If the filename is a relative filename then the list dirs is first searched for readable files fname .
If the option multiple is set True, then a complete list of readable files is returned. Otherwise, just the first readable entry encountered.
Returns True if the value is a float or int, False otherwise
Quantize a value by limits and return the quantized value.
For a given location list of len len(location) return a set of default limits information [0,None,1] of the right length.
A convenience function to set up the logfiles
The logfile is generated in logfile which may be in logdir if it is not an absolute filename.
The item ‘name’ is used as an identifier in the log.
The debug sets the level of logging (not curretly in use)
For a non-spectral model, e.g. Kernels observation operator we have to increase size of the model state vector by multiplying by the number of observation ‘states’ (wavebands).
For example, if we have a MODIS kernel model, with 3 parameters
Isotropic RossThick LiSparseModis
and we have observations in 7 MODIS wavebands:
465.6 553.6 645.5 856.5 1241.6 1629.1 2114.1
Then we require 7 x 3 = 21 state variables per observation location (i.e. per day, row, col) to represent this.
We do this by forming pseudo state variables e.g.
Isotropic.465.6 Isotropic.553.6 etc
but it would be rather tedious to have to define all of that in a problem configuration.
This method sort_non_spectral_model is only called if there is a y State (an observation) that is declared to be non spectral. This is switched on by using:
general.is_spectral = False
in the configuration file.
Note that not all state variables are ‘made spectral’ (i.e. transformed to Isotropic.465.6 Isotropic.553.6 etc.) ... it is only those associated with the x state of operators that contain both x and y states. So, for example, we might have an operator (e.g. a regularisation operator) with a parameter gamma_time. Since this operator contains only x state, there is no need to ‘make spectral’ the gamma_time state. If however we had a prior operator, which would have both x and y states, the declared x state would be ‘made spectral’.
A safe interface to logging for passing log information between lots of classes
A utility to set the dictionary entry to value if it is not set, and in any case return the entry.