Package: webgeodyn
webgeodynis a web-based plot tool to visualize Earth core flows and scalar fields at the Core Mantle Boundary (CMB). It consists in a Tornado web server, that can be started locally, that provides a set of visualisation tools on a variety of data formats.InstallationRequirementsThe installation of webgeodyn requires Python 3 to be installed.The other dependencies will be automatically installed by the next step but are listed here for the sake of completeness:numpyscipy(version > 1.1)h5pytornadocdflibastropyInstalling the packagewebgeodyn can be installedfrom pip:pip3installwebgeodyn[--user]Put the--userflag if you are not installing in avirtual environment.from the git repository :Clone first the webgeodyn repositorygitclonehttps://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/webgeodyn.gitThen install the package:cdwebgeodynpython3setup.pyinstall[--user]Again, put the--userflag if needed.Whatever the method used, you can test if the install succeed by importing webgeodyn in Python3:python3-c"import webgeodyn; print(webgeodyn.__version__)"This command should return the installed version.Running the exampleYou can give a first try at starting the web server by running the example:python3webgeodyn/example.pyor in the Python console:>>>importwebgeodyn.example>>>webgeodyn.example.run()This starts the server locally and should open your browser and display a page resembling the one athttps://geodyn.univ-grenoble-alpes.fr/. If not, try to typehttp://localhost:8080in your browser.You can try the different visualisations tools provided on the loaded example model (CHAOS-7).Note that this example will also try to load the result from the latestpygeodyn(geomagnetic data assimilation Python package also developed in our group) computation (if present in~/pygeodyn_results/Current_computation/).Running the server with your dataThe server can be used to visualise any data of supported format. For that, it is necessary to follow the template ofexample.py:First, load the data under the form ofModelobjects, of a given name and format, in aModelsdictionary.Then, the server must be started with the loadedModels.This is shown in details below:# 0.Import the necessary submodulesimportwebgeodyn.serverimportwebgeodyn.models# 1.Initialising the Models dictionarymodels=webgeodyn.models.Models()# 2.Loading your data in the Models dictionary# Syntax: models.loadModel('/path/to/the/model/directory', "Name of the model", "Format of the model")# Example for pygeodyn:models.loadModel('pygeodyn_results/Current_computation','Current pygeodyn computation','pygeodyn_hdf5')# Several models can be loaded at once. Example for CHAOS:models.loadModel('webgeodyn/webgeodyn/example_data/CHAOS-7','CHAOS-7.13','CHAOS')# 3.Start the server with the loaded Modelswebgeodyn.server.startServer(models,{})By copying this code in a Python file of your own, you should be able to use the visualisation tools on data of supported formats.The format of the models, that define the format of the files to read, are the modules ofwebgeodyn.inout. Here are some dataFormat examples:archomag: to read COVARCH et COVLAKE fileschaos: to readCHAOSsplines filescovobs: to readCOVOBSrealisations files in the spherical harmonics basiscovobs_splines: to readCOVOBSrealisations files filled with splines coefficientsenscore: to read files generated using[GBF15]-pygeodyn_asc: for files in the old ASCII format used in pygeodynpygeodyn_hdf5: to read HDF5 files generated bypygeodynZForecast: to read files generated by[BHF18]or[BGA17]A list of the formats can be displayed by running:>>>importwebgeodyn.inout>>>print(webgeodyn.inout._formats)If you need the support of a new format of file, you can follow the templates given in the documentation ofwebgeodyn.inoutto implement your own loading function. Otherwise, you can contact us using the information given below.Developer documentationDocumentation of the submodules of the package are availableonline.IfSphinxis installed and the files were cloned from the repository, it is possible to generate the documentation locally using:cddoc&&./make_all_doc.shThe documentation will then be available in HTML format at doc/html/index.html.Conditions of useThe work is licensed under theGNU GPLv3.Git repositoryThe source code is stored on a Git repository (https://gricad-gitlab.univ-grenoble-alpes.fr/Geodynamo/webgeodyn) which can also be used to give feedbacks throughIssues.References[GBF15]Gillet, N., Barrois, O. & Finlay, C. C. Stochastic forecasting of the geomagnetic field from the COV-OBS.x1 geomagnetic field model, and candidate models for IGRF-12.Earth, Planets and Space67, (2015). doi:10.1186/s40623-015-0225-z[BGA17]Barrois, O., N. Gillet, and J. Aubert. “Contributions to the geomagnetic secular variation from a reanalysis of core surface dynamics.” Geophysical Journal International 211.1 (2017): 50-68.[BHF18]Barrois, O., Hammer, M. D., Finlay, C. C., Martin, Y. & Gillet, N. Assimilation of ground and satellite magnetic measurements: inference of core surface magnetic and velocity field changes.Geophysical Journal International(2018). doi:10.1093/gji/ggy297Contact informationFor scientific inquiries, contactNicolas Gillet. For technical problems, contactFrancois Dallastaand/orFranck Thollard.