Difference between revisions of "Dynlib"

m (References)
m (Obtaining dynlib)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== [[Dynlib Documentation|Documentation]] ==
+
== [http://folk.uib.no/csp001/dynlib_doc/ Documentation] ==
  
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 [http://folk.uib.no/csp001/dynlib_doc/ the main documentation website].
  
== Obtaining dynlib ==
+
== Use the centrally installed dynlib ==
 +
 
 +
Dynlib is installed centrally for python 2.7 and python 3.4 in the python environments at <code>/Data/gfi/users/local/share/virtualenv/dynpie2</code> and <code>/Data/gfi/users/local/share/virtualenv/dynpie3</code>. You'll only have to activate one of these python enviroments to start using dynlib:
 +
<pre>source /Data/gfi/users/local/share/virtualenv/dynpieX/bin/activate</pre>
 +
In this command <code>X=2</code> for python 2.7 and <code>X=3</code> for python 3.4. For convenience add this command to your <code>~/.bash_profile</code> to activate the respective python environment automatically at each login.
 +
 
 +
'''Note''': For some types of login <code>.bash_profile</code> is not taken into account. In case you'll experience problems create a symbolic link <code>~/.bashrc</code> to point to the <code>~/.bash_profile</code> and re-login.
 +
 
 +
== Quick start to developing with dynlib ==
 +
 
 +
The following procedure is only necessary if you want to start developing dynlib further, for example if you want to add your own functions to dynlib. If you only want to use dynlib, the procedure in the above section is all you need.
 +
 
 +
=== Obtaining dynlib ===
  
 
# Copying the source code repository
 
# Copying the source code repository
#:<code>git clone /Data/gfi/users/tsp065/lib/dynlib.git</code>
+
#:<code>$ git clone /Data/gfi/users/local/src/dynlib.git</code>
 +
#:To clone the repository to your laptop or any machine outside the UiB network, use
 +
#:<code>$ git clone <username>@login.uib.no:/Data/gfi/users/local/src/dynlib.git</code>
 
# Change into the dynlib folder
 
# Change into the dynlib folder
#:<code>cd dynlib</code>
+
#:<code>$ cd dynlib</code>
 
# Compile the library
 
# Compile the library
#:<code>./compile</code>
+
#:<code>$ ./compile</code>
 
+
# (known broken right now) Make sure everything works as expected
== Quick start to developing with dynlib ==
+
#:<code>$ ./test</code>
 +
# To use your personal development version of dynlib instead of the centrally installed one, create a symlink in your scripts folder that points to the development version
 +
#:<code><in script folder>$ ln -s <path-to-dynlib>/lib dynlib</code>
 +
Happy developing!
  
 
=== Editing the Fortran code ===
 
=== Editing the Fortran code ===
  
The fortran code lives in the main source code directory. At the moment there are six source code files
+
The fortran code lives in <code>lib/fortran</code> directory. At the moment there are 16 source code files<br />
:<code>$ ls *.f95
+
<nowiki>$ ls *.f90
:dynlib_config.f95  dynlib_const.f95  dynlib_conv.f95  dynlib_diag.f95  dynlib_kind.f95  dynlib_stat.f95</code>
+
config.f90            detect_lines.f90      ellipse.f90            stat.f90
The most important are <code>dynlib_diag.f95</code> which contains subroutines that calculate various diagnostics, and <code>dynlib_stat.f95</code> which contains statistical functions. Changed Fortran sources need to be recompiled, again using  
+
const.f90              detect_rwb_contour.f90 interpol.f90          tend.f90
:<code>./compile</code>
+
derivatives.f90        diag.f90              kind.f90              thermodyn.f90
 +
detect.f90            diag_tend.f90          sphere.f90            utils.f90</nowiki>
 +
The most important are <code>diag.f90</code> which contains subroutines that calculate various diagnostics, and <code>detect.f90</code> which contains feature detection algorithms. Changed Fortran sources need to be recompiled, again using  
 +
:<code>$ ./compile</code>
  
 
=== [[git|Version control]] ===
 
=== [[git|Version control]] ===
  
 
The changes you made to the source code files can be listed by
 
The changes you made to the source code files can be listed by
:<code>git status</code>
+
:<code>$ git status</code>
 
or viewed in detailed diff-comparisons by
 
or viewed in detailed diff-comparisons by
:<code>git diff</code>
+
:<code>$ git diff</code>
 
or for one file only
 
or for one file only
:<code>git diff [filename]</code>
+
:<code>$ git diff <filename></code>
 +
 
 +
In case you want to undo your changes, you can revert any file to the last committed version by
 +
:<code>git checkout <filename></code>
  
 
Commit your changes from time to time and give a sensible and brief description of your changes in the editor that is opened (automatically)
 
Commit your changes from time to time and give a sensible and brief description of your changes in the editor that is opened (automatically)
:<code>git commit -a</code>
+
:<code>$ git commit -a</code>
 
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.
 
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.
  
Line 39: Line 62:
 
=== Using the Fortran functions ===
 
=== Using the Fortran functions ===
  
An example python script which calculates deformation using the Fortran function is provided with <code>deformation.py</code>.
+
An example python script which calculates deformation using the Fortran function is provided in the [http://folk.uib.no/csp001/dynlib_doc/examples.html documentation].
  
 
== Dynlib functions ==
 
== Dynlib functions ==
  
The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitudes and longitudes, respectively. The function descriptions below contain detailed descriptions of arguments and returns where there is any deviation from this pattern; otherwise they may be assumed to be of the form:
+
The functions are classified into different categories. All functions and categories listed in the [http://folk.uib.no/csp001/dynlib_doc/apidoc.html API documentation].
 
 
[[Dynlib diag functions|Dynlib diagnostic functions]]
 
 
 
==References==
 
<bibtex>
 
@article{KeyReeRee1988,
 
author = {Keyser, D. and Reeder, M. J. and Reed, R. J.},
 
title = {A Generalization of Petterssen Frontogenesis Function and Its Relation to the Forcing of Vertical Motion},
 
journal = {Monthly Weather Review},
 
volume = {116},
 
number = {3},
 
pages = {762-780},
 
year = {1988},
 
url = {<Go to ISI>://A1988N255100017},
 
}
 
</bibtex>
 
<bibtex>
 
@article{LapKleHua1999,
 
  author = {Lapeyre, G. and Klein, P. and Hua, B. L.},
 
  title = {Does the tracer gradient vector align with the strain eigenvectors in 2D turbulence?},
 
  journal = {Physics of Fluids},
 
  volume = {11},
 
  number = {12},
 
  pages = {3729-3737},
 
  year = {1999},
 
  url = {<Go to ISI>://000083495900013
 
http://scitation.aip.org/getpdf/servlet/GetPDFServlet?filetype=pdf&id=PHFLE6000011000012003729000001&idtype=cvips&doi=10.1063/1.870234&prog=normal},
 
}
 
</bibtex>
 
<bibtex>
 
@book{Mar2010,
 
  author = {Markowski, Paul},
 
  title = {Mesoscale meteorology in midlatitudes},
 
  publisher = {Chichester, West Sussex, UK ;Hoboken, NJ : Wiley-Blackwell, 2010},
 
  url = {http://books.scholarsportal.info/viewdoc.html?id=/ebooks/ebooks2/wiley/2011-12-13/2/9780470682104},
 
  year = {2010},
 
}
 
</bibtex>
 
<bibtex>
 
@article{Oku1969,
 
  author = {Okubo, A.},
 
  title = {Horizontal Dispersion of Foreign Particles in Vicinity of Velocity Singularities Such as Convergences},
 
  journal = {Transactions-American Geophysical Union},
 
  volume = {50},
 
  number = {4},
 
  pages = {182-&},
 
  year = {1969},
 
  url = {<Go to ISI>://A1969C982700332},
 
}
 
</bibtex>
 
<bibtex>
 
@article{Riv2009,
 
  author = {Riviere, G.},
 
  title = {Effect of Latitudinal Variations in Low-Level Baroclinicity on Eddy Life Cycles and Upper-Tropospheric Wave-Breaking Processes},
 
  journal = {Journal of the Atmospheric Sciences},
 
  volume = {66},
 
  number = {6},
 
  pages = {1569-1592},
 
  year = {2009},
 
  url = {<Go to ISI>://000267263300006},
 
}
 
</bibtex>
 
  
 
[[Category:Dynlib]]
 
[[Category:Dynlib]]
 
[[Category:Libraries]]
 
[[Category:Libraries]]

Latest revision as of 16:04, 18 September 2017

Documentation

The steps necessary to obtain dynlib are described below. A more thorough documentation is compiled in the main documentation website.

Use the centrally installed dynlib

Dynlib is installed centrally for python 2.7 and python 3.4 in the python environments at /Data/gfi/users/local/share/virtualenv/dynpie2 and /Data/gfi/users/local/share/virtualenv/dynpie3. You'll only have to activate one of these python enviroments to start using dynlib:

source /Data/gfi/users/local/share/virtualenv/dynpieX/bin/activate

In this command X=2 for python 2.7 and X=3 for python 3.4. For convenience add this command to your ~/.bash_profile to activate the respective python environment automatically at each login.

Note: For some types of login .bash_profile is not taken into account. In case you'll experience problems create a symbolic link ~/.bashrc to point to the ~/.bash_profile and re-login.

Quick start to developing with dynlib

The following procedure is only necessary if you want to start developing dynlib further, for example if you want to add your own functions to dynlib. If you only want to use dynlib, the procedure in the above section is all you need.

Obtaining dynlib

  1. Copying the source code repository
    $ git clone /Data/gfi/users/local/src/dynlib.git
    To clone the repository to your laptop or any machine outside the UiB network, use
    $ git clone <username>@login.uib.no:/Data/gfi/users/local/src/dynlib.git
  2. Change into the dynlib folder
    $ cd dynlib
  3. Compile the library
    $ ./compile
  4. (known broken right now) Make sure everything works as expected
    $ ./test
  5. To use your personal development version of dynlib instead of the centrally installed one, create a symlink in your scripts folder that points to the development version
    <in script folder>$ ln -s <path-to-dynlib>/lib dynlib

Happy developing!

Editing the Fortran code

The fortran code lives in lib/fortran directory. At the moment there are 16 source code files

$ ls *.f90
config.f90             detect_lines.f90       ellipse.f90            stat.f90
const.f90              detect_rwb_contour.f90 interpol.f90           tend.f90
derivatives.f90        diag.f90               kind.f90               thermodyn.f90
detect.f90             diag_tend.f90          sphere.f90             utils.f90

The most important are diag.f90 which contains subroutines that calculate various diagnostics, and detect.f90 which contains feature detection algorithms. 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 in the documentation.

Dynlib functions

The functions are classified into different categories. All functions and categories listed in the API documentation.