Commit d376a8ae authored by Loic Huder's avatar Loic Huder
Browse files

Changed GeDACCMU in pygeodyn in files

parent ceb9ce1f
......@@ -49,7 +49,7 @@ build_docs:
stage: test
script:
- sphinx-apidoc -e -o doc -f GeDACCMU/
- sphinx-apidoc -e -o doc -f pygeodyn/
- export PYTHONPATH=$PYTHONPATH:$(pwd) && cd doc && sphinx-build -b html . html && ls html && cd ..
artifacts:
......@@ -101,13 +101,13 @@ pages:
variables:
GIT_STRATEGY: none
script:
- git clone http://$CR_USERNAME:$CR_TOKEN@gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/gedaccmu.git
- cd gedaccmu_testcd
- git clone http://$CR_USERNAME:$CR_TOKEN@gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn.git
- cd pygeodyn_testcd
- git checkout master
- git pull
- python3 release/releasing.py > changes.log
- ./release/do_git_release.sh
- git push http://$CR_USERNAME:$CR_TOKEN@gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/gedaccmu.git master --tags
- git push http://$CR_USERNAME:$CR_TOKEN@gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn.git master --tags
only:
refs:
- master
......
# Changelog of GeDACCMU
# Changelog of pygeodyn
0.7
---
......
......@@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
pygeodyn_DA
pygeodyn
Copyright (C) 2019 N. Gillet
This program is free software: you can redistribute it and/or modify
......@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
pygeodyn_DA Copyright (C) 2019 N. Gillet
pygeodyn Copyright (C) 2019 N. Gillet
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
......
# pygeodyn_DA
# pygeodyn
[![build status](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn_DA/badges/master/build.svg)](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn_DA/pipelines)
[![coverage report](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn_DA/badges/master/coverage.svg)](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn_DA/htmlcov/)
[![documentation](https://img.shields.io/badge/documentation-here!-%2300c5c5.svg)](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn_DA/index.html)
[![build status](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn/badges/master/build.svg)](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn/pipelines)
[![coverage report](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn/badges/master/coverage.svg)](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/htmlcov/)
[![documentation](https://img.shields.io/badge/documentation-here!-%2300c5c5.svg)](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/index.html)
Data assimilation algorithms applied to geomagnetic data in the spectral domain.
......@@ -12,7 +12,7 @@ From Olivier Barrois, Nicolas Gillet, Loïc Huder, Yannick Martin and Franck Tho
## Installation
### Requirements
The installation of pygeodyn_DA requires Python 3 (tested under 3.5) to be installed with the following packages:
The installation of pygeodyn requires Python 3 (tested under 3.5) to be installed with the following packages:
* _setuptools_ (tested against 40.4.3): to be able to run `setup.py`.
* _numpy_ (at least 1.7): to be able to wrap Fortran files with _f2py_.
......@@ -25,21 +25,21 @@ The other dependencies will be automatically installed by the next step but are
* _matplotlib_
* _hypothesis_ (only for the tests)
### Install the pygeodyn_DA package
### Install the pygeodyn package
Note: Two installation strategies are proposed: a classical installation and an installation in a virtual envrionnement. The latter is preferred as it gives more control on the Python environment used to run the program. The rest of the README is independent of the chosen strategy.
#### Classical installation
If the requirements are satisfied, pygeodyn_DA can be installed by running
If the requirements are satisfied, pygeodyn can be installed by running
```sh
python3 setup.py develop --user
```
> The ```develop``` option links the current folder in the python library. Any modification will be immediately taken into account without the need to install the package again. It is also needed for relative path resolution.
Test if the installation succeeded by importing pygeodyn_DA in python3
Test if the installation succeeded by importing pygeodyn in python3
```
python3 -c "import pygeodyn_DA; print(pygeodyn_DA.__version__)"
python3 -c "import pygeodyn; print(pygeodyn.__version__)"
```
This should print the current version of pygeodyn_DA if the installation succeeded.
This should print the current version of pygeodyn if the installation succeeded.
#### How to install in a virtual environment
The virtual environnement is a closed space that allows to control the Python packages' installation. This is therefore the preferred installation strategy as it also works on clusters where not all rights are given.
......@@ -60,19 +60,19 @@ Once the virtual environment is set up, all package installations and launching
```bash
source /path/to/new/virtual/environment/bin/activate
```
Being inside the virtual env is notified by the `(<folder_name>)` (with <folder_name> the name of the folder of the virtual env) at the left of the command line. If so, pygeodyn_DA and its dependencies can now be installed.
Being inside the virtual env is notified by the `(<folder_name>)` (with <folder_name> the name of the folder of the virtual env) at the left of the command line. If so, pygeodyn and its dependencies can now be installed.
_Setuptools_ and _pip_ should be installed in the virtual env allowing to install the numpy requirement:
```bash
pip3 install numpy
```
Once this is completed, we can install pygeodyn_DA as previously:
Once this is completed, we can install pygeodyn as previously:
```bash
python3 setup develop
```
Once again, test if the installation succeeded by importing pygeodyn_DA in python3
Once again, test if the installation succeeded by importing pygeodyn in python3
```
python3 -c "import pygeodyn_DA; print(pygeodyn_DA.__version__)"
python3 -c "import pygeodyn; print(pygeodyn.__version__)"
```
To exit the virtual env, run
......@@ -88,7 +88,7 @@ python3 setup.py test
```
Please report any failed tests using the contact info given at the end of the README file.
Detailed information on the coverage of the tests can be found on [GRICAD](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn_DA/htmlcov/).
Detailed information on the coverage of the tests can be found on [GRICAD](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/htmlcov/).
### Reinstallation
```sh
......@@ -98,7 +98,7 @@ python3 setup.py develop --user
## Usage
pygeodyn_DA uses configuration files (extension: `.conf`) to set the computation parameters. See [example.conf](./example.conf) for an example of such a configuration file.
pygeodyn uses configuration files (extension: `.conf`) to set the computation parameters. See [example.conf](./example.conf) for an example of such a configuration file.
### Launching the algorithm
The computation is launched by running `run_algo.py`. Several parameters can be given in arguments to tune the computation. The only one needed is `-conf` whereas default behaviours are set if the other arguments are not given.
......@@ -108,7 +108,7 @@ The computation is launched by running `run_algo.py`. Several parameters can be
* `-algo`: the name of the algorithm to use. As for now, the only supported algorithm is **augkf** (Augmented state Kalman Filter implemented in Python) which is the default value.
* `-seed`: a number used for the generation of random quantities. Set this to get reproducible results (default: generate a new one at each execution).
##### Output files
* `-path`: path where the folder results will be created (default: `~/pygeodyn_DA_results/`).
* `-path`: path where the folder results will be created (default: `~/pygeodyn_results/`).
* `-cname`: name of the computation. Used to create a folder in `-path` where the results will be saved (default: `Current_computation`).
##### Logging
* `-v`: level of the logging: 1 DEBUG, 2 INFO (default), 3 WARNING, 4 ERROR, 5 CRITICAL.
......@@ -133,21 +133,21 @@ mpiexec -np 2 python3 run_algo.py -v 3 -conf augkf.conf -path './results/' -m 3
### Saving results
#### Output folder
When a new computation is launched, pygeodyn_DA creates a folder of name `-cname` (default: `Current_computation`) at the location given in `-path` (default: `~/pygeodyn_DA_results/`). All result files will be created in this output folder.
When a new computation is launched, pygeodyn creates a folder of name `-cname` (default: `Current_computation`) at the location given in `-path` (default: `~/pygeodyn_results/`). All result files will be created in this output folder.
#### Hdf5 file
The default behaviour of pygeodyn_DA is to automatically save the results at each time iteration in an hdf5 file of name `-cname`. This way, even in case of a crash, all previous iterations should be saved.
The default behaviour of pygeodyn is to automatically save the results at each time iteration in an hdf5 file of name `-cname`. This way, even in case of a crash, all previous iterations should be saved.
## For more information
### In-depth guide
We only presented here the high-level use of pygeodyn_DA that is encapusated in `run_algo.py` with supplied data. If you wish to use your own data, have more information on the implementation or use low-level features, please refer to the [In-depth guide](doc/guide.md) in the `doc` folder.
We only presented here the high-level use of pygeodyn that is encapusated in `run_algo.py` with supplied data. If you wish to use your own data, have more information on the implementation or use low-level features, please refer to the [In-depth guide](doc/guide.md) in the `doc` folder.
### Developer documentation
Documentation of the submodules and methods of the package are available on [GRICAD](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn_DA/index.html).
Documentation of the submodules and methods of the package are available on [GRICAD](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/index.html).
If [Sphinx](http://www.sphinx-doc.org/) is installed, it is possible to generate the documentation locally using:
```sh
sphinx-apidoc -e -o doc -f pygeodyn_DA/
sphinx-apidoc -e -o doc -f pygeodyn/
cd doc && sphinx-build -b html . html && cd ..
```
The doc will then be available in HTML format at doc/html/index.html.
......@@ -169,7 +169,7 @@ If the use of this code led to a scientific output, please cite:
- [Huder, Gillet and Thollard, submitted (2019)]()
### Git repository
The source code is stored on a Git repository (https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn_DA) which can also be used to give feedbacks through [Issues](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn_DA/issues).
The source code is stored on a Git repository (https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn) which can also be used to give feedbacks through [Issues](https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/pygeodyn/issues).
### Contact information
For scientific inquiries, contact [Nicolas Gillet](mailto:nicolas.gillet@univ-grenoble-alpes.fr). For technical problems (including failed tests), contact [Loïc Huder](mailto:loic.huder@univ-grenoble-alpes.fr) or [Franck Thollard](mailto:franck.thollard@univ-grenoble-alpes.fr).
\ No newline at end of file
......@@ -18,7 +18,7 @@ import os
# -- Project information -----------------------------------------------------
project = u'GeDACCMU'
project = u'pygeodyn'
# Author list
with open(os.path.join(os.path.dirname(__file__), '../AUTHORS.txt')) as author_file:
author = author_file.read().replace('\n', ' ')
......@@ -109,7 +109,7 @@ html_static_path = ['_static']
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'GeDACCMUdoc'
htmlhelp_basename = 'pygeodyndoc'
# -- Options for LaTeX output ------------------------------------------------
......@@ -136,7 +136,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'GeDACCMU.tex', u'GeDACCMU Documentation',
(master_doc, 'pygeodyn.tex', u'pygeodyn Documentation',
author, 'manual'),
]
......@@ -146,7 +146,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'gedaccmu', u'GeDACCMU Documentation',
(master_doc, 'pygeodyn', u'pygeodyn Documentation',
[author], 1)
]
......@@ -157,8 +157,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'GeDACCMU', u'GeDACCMU Documentation',
author, 'GeDACCMU', 'One line description of project.',
(master_doc, 'pygeodyn', u'pygeodyn Documentation',
author, 'pygeodyn', 'One line description of project.',
'Miscellaneous'),
]
......
# In-depth guide
## Presentation
In README.md was presented a way to use GeDACCMU through the use of `run_algo.py`. The `run_algo.py` program takes care of chaining and looping the data assimilation steps (and of numerous handy things such as the uses of multiple processes with mpi4py, the saving of output files and of logs). For more details, we present here the structure of the said program:
In README.md was presented a way to use pygeodyn through the use of `run_algo.py`. The `run_algo.py` program takes care of chaining and looping the data assimilation steps (and of numerous handy things such as the uses of multiple processes with mpi4py, the saving of output files and of logs). For more details, we present here the structure of the said program:
<img src="Structure.svg" alt="run_algo_structure" width="2000"/>
The initialisation of the algorithm is done by the [init_algorithm](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.run.html) method. This is a two-step method:
* First, `read_conf` reads the configuration file (see [example.conf](../example.conf)) to build a [ComputationConfig](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.inout.config.html) object named `config`.
The initialisation of the algorithm is done by the [init_algorithm](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.run.html) method. This is a two-step method:
* First, `read_conf` reads the configuration file (see [example.conf](../example.conf)) to build a [ComputationConfig](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.inout.config.html) object named `config`.
* Secondly, the `config` object is passed to the `launch_setup` method that will generate a _Forecaster_ object and an _Analyser_ object. The _Forecaster_ and _Analyser_ respectively implement the methods _forecast_step_ and _analysis_step_ that are the main components of the data assimilation process. The `run_algo.py` runs forecast and analysis steps on `CoreStates` (see below) at a frequency given by the user in the configuration file.
The two objects _Forecaster_ and _Analyser_ integrate all the input data that result from the algorithm initialisation:
......@@ -24,7 +24,7 @@ For examples, you can refer to the priors embarked with the program (that are ou
* [Coupled-Earth](http://dx.doi.org/10.1038/nature12574) (prior_type: `coupled_earth`)
* [Midpath](https://doi.org/10.1017/jfm.2016.789) (prior_type: `midpath`)
The reading methods are found in [`GeDACCMU/inout/priors.py`](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.inout.priors.html)
The reading methods are found in [`pygeodyn/inout/priors.py`](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.inout.priors.html)
. To use you own data, you must implement your reading method in the same file and design it with the same format. Namely:
```python
# The method name must have this name format and signature
......@@ -42,7 +42,7 @@ Examples of valid reading methods are given for the embarked observations:
* [COVOBS](https://doi.org/10.1002/2014JB011786) (obs_type: `covobs`)
* [Ground and Virtual observatories](https://doi.org/10.1093/gji/ggy297) (obs_type: `go_vo`)
The strategy to use another type of observations follows the same paradigm as for priors: you must define a new observation type by implementing its reading method in [`GeDACCMU/inout/observations.py`](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.inout.observations.html). In more details, the format must be:
The strategy to use another type of observations follows the same paradigm as for priors: you must define a new observation type by implementing its reading method in [`pygeodyn/inout/observations.py`](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.inout.observations.html). In more details, the format must be:
```python
# The method name must have this name format and signature
def build_<new_obs_type>_observations(cfg, nb_realisations, measure_type):
......@@ -53,7 +53,7 @@ def build_<new_obs_type>_observations(cfg, nb_realisations, measure_type):
The implementation is trickier in this case and several points need to be highlighted:
* Your new reading method must take the measure_type as arg that will be equal to either 'MF' (for magnetic field observations) or 'SV' (for secular variation observations).
* The returned object must be a dictionary with numpy.datetime64 objects as keys that correspond to the date of the observations
* The said dictionary must contain [_Observation_ objects](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.inout.observations.html) that are a handy way to store all the observation parameters:
* The said dictionary must contain [_Observation_ objects](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.inout.observations.html) that are a handy way to store all the observation parameters:
* The data `Y` as 2D numpy.ndarrays (nb_realisations x nb_observed_coefs)
* The observation operator `H` (nb_observed_coefs x nb_coefs) that verifies `Y = HX` where X is a vector containing the spectral coefficients of the magnetic field or secular variation (size: nb_coefs).
* The observation errors matrices `R` (nb_observed_coefs x nb_observed_coefs)
......@@ -73,7 +73,7 @@ After having implemented your new method, set `obs_types` in the config file to
## Using low-level forecast/analysis steps
### The CoreState object
A [_CoreState_](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.corestates.html) is the object on which the computation steps (forecasts and analysis) are performed. It provides an interface to store and act on the data of the involved physical quantities (called *measures*) such as the magnetic field ('MF'), the secular variation ('SV'), the core flow ('U') and the subgrid errors ('ER').
A [_CoreState_](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.corestates.html) is the object on which the computation steps (forecasts and analysis) are performed. It provides an interface to store and act on the data of the involved physical quantities (called *measures*) such as the magnetic field ('MF'), the secular variation ('SV'), the core flow ('U') and the subgrid errors ('ER').
The usual way to use it is to store measure data as 3D NumPy arrays under the format (nb_realisations, nb_times, nb_coeffs) (as used for _computed_states_, _forecast_states_ and _analysed_states_ in `run_algo.py`) but it can handle 1D and 2D NumPy arrays as well.
......@@ -86,7 +86,7 @@ The usual way to use it is to store measure data as 3D NumPy arrays under the fo
##### Adding a measure
* 1D :
```python
from GeDACCMU.corestates import CoreState
from pygeodyn.corestates import CoreState
cs_1D = CoreState()
data_mf_1D = np.zeros(224)
......@@ -114,7 +114,7 @@ cs_1D.addMeasure('U', [data_u_1D, 18])
cs_1D.U # Returns data_u_1D
cs_1D.Lu # Returns the max_degree of 'U' (here: 18 the forced value)
```
Other convenience getters can be found in the complete [documentation](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.corestates.html).
Other convenience getters can be found in the complete [documentation](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.corestates.html).
* 3D :
It works exactly the same but CoreState also implements NumPy-like indexing:
```python3
......@@ -153,7 +153,7 @@ cs_3D.SV[0, 0] # Returns np.ones(224)*2
### Forecast/Analyse a CoreState
We saw in the beginning of this section that the _forecast_step_ (resp. _analysis_step_) was implemented by the _Forecaster_ (resp. _Analyser_) object. The easiest way to set up these objects is to use to the _init_algorithm_ method with the path to the desired configuration file:
```python
from GeDACCMU.run import init_algorithm
from pygeodyn.run import init_algorithm
algo_dict = {'name': 'augkf', 'nb_models': 10}
config_path = 'augkf.conf'
......@@ -193,4 +193,4 @@ cs.U[0, 2] # Analysed values of all core flow coefs for the realisation 0
# and so on...
```
More information can be found in the documentation of the [forecast_step](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.augkf.forecaster.html) [analysis_step](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.augkf.analyser.html) for the [augkf module](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/GeDACCMU/GeDACCMU.augkf.html) for example.
More information can be found in the documentation of the [forecast_step](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.augkf.forecaster.html) [analysis_step](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.augkf.analyser.html) for the [augkf module](https://geodynamo.gricad-pages.univ-grenoble-alpes.fr/pygeodyn/pygeodyn.augkf.html) for example.
GeDACCMU
pygeodyn
========
.. toctree::
:maxdepth: 4
GeDACCMU
pygeodyn
import numpy as np
import logging
from scipy import linalg
from GeDACCMU import common
from GeDACCMU.generic.analyser import GenericAnalyser
from GeDACCMU.corestates import with_core_state_of_dimensions
from pygeodyn import common
from pygeodyn.generic.analyser import GenericAnalyser
from pygeodyn.corestates import with_core_state_of_dimensions
class Analyser(GenericAnalyser):
......
import numpy as np
import logging
from GeDACCMU import common
from GeDACCMU import utilities
import GeDACCMU.generic.forecaster
from GeDACCMU.corestates import with_core_state_of_dimensions
from pygeodyn import common
from pygeodyn import utilities
import pygeodyn.generic.forecaster
from pygeodyn.corestates import with_core_state_of_dimensions
class Forecaster(GeDACCMU.generic.forecaster.GenericForecaster):
class Forecaster(pygeodyn.generic.forecaster.GenericForecaster):
"""
Class that implements the forecasts using AugKF (Augmented state Kalman Filter) algorithm with DIFF treated as a contribution to ER.
"""
......
......@@ -3,12 +3,12 @@ Pre-computation steps
"""
import numpy as np
import GeDACCMU.inout.priors as priors_module
import pygeodyn.inout.priors as priors_module
import os
import logging
from GeDACCMU import common, pca
from GeDACCMU.augkf.forecaster import Forecaster
from GeDACCMU.augkf.analyser import Analyser
from pygeodyn import common, pca
from pygeodyn.augkf.forecaster import Forecaster
from pygeodyn.augkf.analyser import Analyser
from scipy import linalg
......
......@@ -6,9 +6,9 @@ import math
import numpy as np
from scipy import linalg
import fortran
from GeDACCMU.corestates import with_core_state_of_dimensions
from GeDACCMU.constants import r_earth
from GeDACCMU import utilities
from pygeodyn.corestates import with_core_state_of_dimensions
from pygeodyn.constants import r_earth
from pygeodyn import utilities
def compute_direct_obs_operator(positions, max_degree):
......
......@@ -356,8 +356,8 @@ class CoreState:
:type date: datetime64
:return: nothing. Simply update self.
"""
from GeDACCMU.inout.reads import read_computed_states_hdf5
from GeDACCMU.utilities import date_to_decimal
from pygeodyn.inout.reads import read_computed_states_hdf5
from pygeodyn.utilities import date_to_decimal
file_data = read_computed_states_hdf5(file_path)
decimal_date = date_to_decimal(date, 2)
......
#-*- coding: utf-8 -*-
import GeDACCMU.generic.computer
import GeDACCMU.inout.observations as observations_module
import pygeodyn.generic.computer
import pygeodyn.inout.observations as observations_module
import numpy as np
import logging
class GenericAnalyser(GeDACCMU.generic.computer.GenericComputer):
class GenericAnalyser(pygeodyn.generic.computer.GenericComputer):
""" Generic class that implements the steps common to all analyses."""
def __init__(self, config, avg_priors, covariance_matrices, legendre_polys, nb_realisations):
"""
......
import numpy as np
import GeDACCMU.inout.config
import pygeodyn.inout.config
class GenericComputer(object):
......@@ -21,7 +21,7 @@ class GenericComputer(object):
"""
print("Initiate {}".format(type(self)))
if type(config) is not GeDACCMU.inout.config.ComputationConfig:
if type(config) is not pygeodyn.inout.config.ComputationConfig:
raise TypeError('ComputationStep was initialised without ComputationConfig ! Got {} instead.'.format(type(config)))
# Check that the config contains the physical constants needed
......
#-*- coding: utf-8 -*-
import GeDACCMU.generic.computer
import pygeodyn.generic.computer
class GenericForecaster(GeDACCMU.generic.computer.GenericComputer):
class GenericForecaster(pygeodyn.generic.computer.GenericComputer):
""" Generic class that implements the steps common to all forecasters."""
def forecast_step(self, **args):
......
import numpy as np
import logging
from GeDACCMU import constants
from GeDACCMU.inout import reads
import GeDACCMU
from GeDACCMU.utilities import date_array_to_decimal
from pygeodyn import constants
from pygeodyn.inout import reads
import pygeodyn
from pygeodyn.utilities import date_array_to_decimal
import os
from GeDACCMU.pca import NormedPCAOperator
from pygeodyn.pca import NormedPCAOperator
def config_from_hdf5_file(hdf5File):
......@@ -165,11 +165,11 @@ class ComputationConfig(object):
# If not absolute, build the absolute path from the given relative path
given_path = self.__dict__[path_key]
if not os.path.isabs(given_path):
given_path = os.path.normpath(os.path.join(GeDACCMU.package_directory, given_path))
given_path = os.path.normpath(os.path.join(pygeodyn.package_directory, given_path))
if not os.path.exists(given_path):
# Try to correct the path
corrected_path = os.path.join(GeDACCMU.package_directory, given_path.split('GeDACCMU/')[-1])
corrected_path = os.path.join(pygeodyn.package_directory, given_path.split('pygeodyn/')[-1])
# If the corrected path does not exist either, throw an error
if not os.path.exists(corrected_path):
raise IOError('{} given in config does not exist ! Did you supply a relative path instead of an absolute one ?'.format(given_path))
......
......@@ -7,8 +7,8 @@ import math
import logging
import glob
from GeDACCMU.inout import reads
from GeDACCMU import common, utilities
from pygeodyn.inout import reads
from pygeodyn import common, utilities
class Observation:
......
......@@ -3,7 +3,7 @@
import h5py
import os.path
import numpy as np
from GeDACCMU import common
from pygeodyn import common
def read_coupled_earth(data_directory):
......
""" Contains generic reading functions """
import numpy as np
from GeDACCMU import utilities
from pygeodyn import utilities
from collections import defaultdict
import os.path
import h5py
......
......@@ -2,10 +2,10 @@ import numpy as np
import os
import time
import logging
from GeDACCMU.corestates import with_core_state_of_dimensions
from GeDACCMU.utilities import date_array_to_decimal
from pygeodyn.corestates import with_core_state_of_dimensions
from pygeodyn.utilities import date_array_to_decimal
from collections import defaultdict
import GeDACCMU
import pygeodyn
class AsciiFileHandler(object):
......@@ -94,7 +94,7 @@ def saveReadme(readme_path, config, algo_dict, elapsed_time, parallel):
else:
readme.write('Sequential algorithm ')
readme.write('{} (GeDACCMU v{}) finished at {} in {:.2f} s\n'.format(algo_dict['name'].upper(), GeDACCMU.__version__, time.asctime(), elapsed_time))
readme.write('{} (pygeodyn v{}) finished at {} in {:.2f} s\n'.format(algo_dict['name'].upper(), pygeodyn.__version__, time.asctime(), elapsed_time))
readme.write('---\n')
readme.write('{} realisations were considered'.format(algo_dict['nb_models']))
if config.compute_e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment