Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • mapgenerator mapgenerator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 30
    • Issues 30
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • mapgeneratormapgenerator
  • Wiki
  • configure

configure · Changes

Page history
Update configure functions authored Jan 30, 2019 by Francesco's avatar Francesco
Show whitespace changes
Inline Side-by-side
configure.md 0 → 100644
View page @ 983131f8
**Note**: *features described in this page are only available using the tool as a (Python/R) library.*
Bear in mind the initial steps that are always valid before using the tool, in Python:
```
from mapgenerator.plotting import plotmap # import mapgenerator plotting library
pm = plotmap.PlotMap() # create an instance of the class "PlotMap"
```
or, in R:
```
library(reticulate) # load R/Python interface library
plotmap <- import("mapgenerator.plotting.plotmap") # import mapgenerator plotting library
pm <- plotmap$PlotMap() # create an instance of the class *PlotMap*
```
Once done that, you have your *pm* object (instance of *PlotMap* class). All *attributes* and *methods (functions)* can be assigned/modified/executed by this object.
**Assign and modify options through attributes**
All options have their own default value. Calling plotting functions (*plot* or *aplot*) their values can be modified or not. For example:
```
pm.plot(srcfiles='test.nc', srcvars='tas', resolution='h', ..., optionX=valueX)
```
is the same of:
```
pm.srcfiles = 'test.nc'
pm.srcvars = 'tas'
pm.resolution = 'h'
...
pm.optionX = valueX
pm.plot()
```
The difference is that in the first case values are not stored (except *srcfiles* and *srcvars* that are always stored because are the two mandatory options for let the function working) and in the second yes. After executing the plotting function you will find, in the first case:
```
pm.resolution
```
empty, as the default value (None). While in the second case:
```
pm.resolution
'h'
```
The value has been stored.
**Manage configuration files through functions**
Three functions (methods) are available:
1. *loadConf*: loads options from existing configuration file. Input parameters are:
* section - the section of the configuration file (default=None)
* fpath - full path of the configuration file. If None reads *config_dir* and *config_file* variables (default=None)
* reset - if True, reset all options to default before load new values (default=False)
2. *writeConf*: writes current configuration to file. Input parameters are:
* section - the section of the configuration file
* fpath - full path of the conf file. If None reads *config_dir* and *config_file* variables (default=None)
3. *resetConf*: reset configuration to defaults. It doesn't require any option.
**IMPORTANT**: In case of crash of *plot* or *aplot* function execution, *pm.resetConf()* is required, otherwise it will not work. As alternative option the *pm* object can be created again.
**Go [Home](home)**
**Back to [Options](options)**
**Forward to [Examples](examples)**
Clone repository
  • Reports
  • configure
  • example1
  • example2
  • example3
  • examples
  • Home
  • how to use
  • options