Dynlib: Difference between revisions
m Fixed typo |
Adapted to new location. Added centrally installed libary. |
||
Line 3: | Line 3: | ||
The steps necessary to obtain dynlib are described below. A more thorough documentation is compiled in [[Dynlib Documentation|the main documentation page]]. | The steps necessary to obtain dynlib are described below. A more thorough documentation is compiled in [[Dynlib Documentation|the main documentation page]]. | ||
== Obtaining dynlib == | == Use the centrally installed dynlib == | ||
Dynlib is installed centrally in <code>/Data/gfi/users/local/lib/python2.7/site-packages</code>. You'll only have to adapt some paths in your <code>~./bashrc</code> to start using it! Add the following to your <code>~./bashrc</code>: | |||
<pre> | |||
export SHARED='/Data/gfi/users/local' | |||
export PATH="$PATH:$SHARED/bin" | |||
export PYTHONPATH="$PYTHONPATH:$SHARED/lib/python2.7/site-packages" | |||
</pre> | |||
To take into account your changes <code>source ~./bashrc</code>. You can then create a project folder with the default settings file and some example scripts with the command | |||
<code>dynlib_init.py <project-name></code>. | |||
== Quick start to developing with dynlib == | |||
=== Obtaining dynlib === | |||
# Create a new folder for the project that'll use dynlib, and go into that directory. | # Create a new folder for the project that'll use dynlib, and go into that directory. | ||
Line 9: | Line 24: | ||
#:<code>$ cd <project-name></code> | #:<code>$ cd <project-name></code> | ||
# Copying the source code repository | # Copying the source code repository | ||
#:<code>$ git clone / | #:<code>$ git clone $SHARED/src/dynlib.git</code> | ||
#:To clone the repository to your laptop or any machine outside the UiB network, use | #:To clone the repository to your laptop or any machine outside the UiB network, use | ||
#:<code>$ git clone <username>@login.uib.no:/ | #:<code>$ git clone <username>@login.uib.no:$SHARED/src/dynlib.git</code> | ||
# Change into the dynlib folder | # Change into the dynlib folder | ||
#:<code>$ cd dynlib</code> | #:<code>$ cd dynlib</code> | ||
Line 23: | Line 38: | ||
#:<code>example_ani.py example_diag.py example_netcdf_write.py example_stat.py settings.py</code> | #:<code>example_ani.py example_diag.py example_netcdf_write.py example_stat.py settings.py</code> | ||
Happy developing! | Happy developing! | ||
=== Editing the Fortran code === | === Editing the Fortran code === |
Revision as of 14:49, 25 February 2014
Documentation
The steps necessary to obtain dynlib are described below. A more thorough documentation is compiled in the main documentation page.
Use the centrally installed dynlib
Dynlib is installed centrally in /Data/gfi/users/local/lib/python2.7/site-packages
. You'll only have to adapt some paths in your ~./bashrc
to start using it! Add the following to your ~./bashrc
:
export SHARED='/Data/gfi/users/local' export PATH="$PATH:$SHARED/bin" export PYTHONPATH="$PYTHONPATH:$SHARED/lib/python2.7/site-packages"
To take into account your changes source ~./bashrc
. You can then create a project folder with the default settings file and some example scripts with the command
dynlib_init.py <project-name>
.
Quick start to developing with dynlib
Obtaining dynlib
- Create a new folder for the project that'll use dynlib, and go into that directory.
$ mkdir <project-name>
$ cd <project-name>
- Copying the source code repository
$ git clone $SHARED/src/dynlib.git
- To clone the repository to your laptop or any machine outside the UiB network, use
$ git clone <username>@login.uib.no:$SHARED/src/dynlib.git
- Change into the dynlib folder
$ cd dynlib
- Compile the library
$ ./compile
- Make sure everything works as expected
$ ./test
- You can now go back to your main project folder and use dynib from there. Dynlib automatically installed a
settings.py
where you can override the default settings and some examples scripts in that project folder.$ cd ..
$ ls
example_ani.py example_diag.py example_netcdf_write.py example_stat.py settings.py
Happy developing!
Editing the Fortran code
The fortran code lives in src
directory. At the moment there are 12 source code files
$ ls src/*.f95
- src/config.f95 src/derivatives.f95 src/detect_fronts.f95 src/diag.f95 src/humidity.f95 src/stat.f95
src/const.f95 src/detect.f95 src/detect_rwb_contour.f95 src/ellipse.f95 src/kind.f95 src/utils.f95
- The most important are
diag.f95
which contains subroutines that calculate various diagnostics, andstat.f95
which contains statistical functions. Changed Fortran sources need to be recompiled, again using $ ./compile
Version control
The changes you made to the source code files can be listed by
$ git status
or viewed in detailed diff-comparisons by
$ git diff
or for one file only
$ git diff <filename>
In case you want to undo your changes, you can revert any file to the last committed version by
git checkout <filename>
Commit your changes from time to time and give a sensible and brief description of your changes in the editor that is opened (automatically)
$ git commit -a
The commit is then stored in your copy of the source code repository, but not yet available for others, which allows you to also commit work-in-progress.
A more thorough introduction to the version control system is given here or on the official documentation.
Using the Fortran functions
An example python script which calculates deformation using the Fortran function is provided with example_diag.py
.
Dynlib functions
The functions are classified into different categories.