Skip to content

Commit

Permalink
deploy: c4c034c
Browse files Browse the repository at this point in the history
  • Loading branch information
samharrison7 committed Jul 7, 2024
1 parent 666b05f commit f29c32b
Show file tree
Hide file tree
Showing 31 changed files with 128 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: ec3a3ab04bc695e9ca4d5d3a9a2762c3
config: a47af5ef49e4a3f3e68cea3520f65a53
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 2 additions & 2 deletions _sources/getting-started/building-the-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ If your system has multiple versions of GFortran installed, make sure that the N

First, get a copy of the code by cloning the repo, making sure to specify `--recurse-submodules` to pull in code for the submodules in the `vendor/` directory:

```shell
```console
$ git clone https://github.com/nerc-ceh/nanofase.git --recurse-submodules
$ cd nanofase
```

If you forget the `--recurse-submodule` flag, then run the following from the repo directory:

```shell
```console
$ git submodule update --init --recursive
```

Expand Down
4 changes: 2 additions & 2 deletions _sources/getting-started/running-the-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

The model requires a config file to run. Examples are given in the [config.example](https://github.com/NERC-CEH/nanofase/tree/develop/config.example) directory. The examples are commented and should be relatively self-explanatory. Copy one of these to a new file and edit as you wish. Make sure the directories you specify for output data and logs exist, otherwise the model will fail. Then pass this config file as the first argument when calling the model executable. For example, if you have installed the model to somewhere on your path:

```shell
```console
$ mkdir config && cp config.example/config.example.nml config/my_config.nml
$ nanofase config/my_config.nml
```

Or if you wish to run via fpm without installing:

```shell
```console
# Debug version
$ fpm @run -- config/my_config.nml
# Release version with optimisations
Expand Down
6 changes: 3 additions & 3 deletions _sources/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The easiest way to install the model is to use the [Fortran Package Manager](htt

Clone the code (make sure to `--recurse-submodules`) and use *fpm* to install:

```shell
```console
$ git clone [email protected]:NERC-CEH/nanofase.git --recurse-submodules
$ cd nanofase
$ fpm @install
Expand All @@ -26,14 +26,14 @@ Use the `--prefix <path-to-installation-dir>` flag to install the model into a d

Test the model with the [test scenario](getting-started/test-scenario.md). Presuming the install directory is on your `$PATH`:

```shell
```console
$ mkdir log output
$ nanofase config.example/test-scenario.example.nml
```

Or you can use fpm to run the model, without needing to install it first (i.e. omitting the `fpm @install` step above):

```shell
```console
# Debug version
$ fpm @run -- config.example/test-scenario.example.nml
# Release version with optimisations turned on
Expand Down
4 changes: 2 additions & 2 deletions _sources/users/input-data.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Input data

The model requires a NetCDF file of spatio(temporal) input data, and a Fortran namelist file for constants. The config file is responsible for telling the model where these input data are located (via the `&data` group). There are two options for generating these input data files:
* *Recommended*: Use the [NanoFASE data module](https://github.com/nerc-ceh/nanofase-data) - see [](nanofase-data). This is a Python script that compiles multiple spatio(temporal) input files into the main NetCDF file, at the same time as deriving secondary variables from these data, which are required by the model.
* *Recommended*: Use the [NanoFASE data module](https://github.com/nerc-ceh/nanofase-data) - see [](nanofase-data). This is a Python library that compiles multiple spatio(temporal) input files into the main NetCDF file, at the same time as deriving secondary variables from these data, which are required by the model.
* Manually creating (or editing a copy of) the NetCDF and namelist files. This is not recommended for compiling new data (though can be useful for editing existing data) due to the requirement for a range of [secondary derived variables](netcdf-namelist-input:secondary-derived-variables) that would have to be calculated manually. If you wish to go down this route, see [](netcdf-namelist-input) for details of the variables required in the NetCDF and constants namelist file.

The complete list of parameters required by the model is givin in [](parameter-reference). Example NetCDF and constants files are given in the [data.example](https://github.com/NERC-CEH/nanofase/tree/develop/data.example) directory.

% draw diagram of data input components
% TODO draw diagram of data input components
43 changes: 32 additions & 11 deletions _sources/users/nanofase-data.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
# Compiling data with the NanoFASE data module

The *NanoFASE data module* (`nfdata`) is a Python library that is used to compile input data for the model. It is recommended to use this library over and above manually compiling the NetCDF and constants namelist file required by the model, as the data module scripts take care of deriving a variety of [secondary derived variables](netcdf-namelist-input:secondary-derived-variables), amongst other reasons.
The *NanoFASE data module* (`nfdata`) is a Python package that is used to compile input data for the model. It is recommended to use this package over and above manually compiling the NetCDF and constants namelist file required by the model, as the data module scripts take care of deriving a variety of [secondary derived variables](netcdf-namelist-input:secondary-derived-variables), amongst other reasons.

The library can be [found on GitHub](https://github.com/nerc-ceh/nfdata).
The package source code can be [found on GitHub](https://github.com/nerc-ceh/nfdata).

## Getting started

The easiest way to use the library is to [install it from PyPI](https://pypi.org/project/nfdata/). For example, using pip:
The package is available on [PyPI](https://pypi.org/project/nfdata/) or [Conda](https://anaconda.org/samharrison7/nfdata), and the easiest way to use the package is to install one of these using Pixi, Conda/Mamba or Pip:

```bash
`````{tab-set}
````{tab-item} Conda
```console
$ conda install -c samharrison7 nfdata
```
````
````{tab-item} Mamba
```console
$ mamba install -c samharrison7 nfdata
```
````
````{tab-item} Pip
```console
$ pip install nfdata
```

```{note}
We are currently working on a Conda package for the library - watch this space!
````
````{tab-item} Pixi (global)
```console
$ pixi global install -c samharrison7 nfdata
```
````
````{tab-item} Pixi (project)
```console
$ pixi project channel add samharrison7
$ pixi add nfdata
```
````
`````

## Basic usage

Once installed, the library can be run via the command line using the `nfdata` command:
Once installed, the package can be run via the command line using the `nfdata` command:

```
$ nfdata --help
Expand All @@ -41,7 +62,7 @@ options:

Specifying the "create" option compiles a new NetCDF dataset and Fortran namelist constant file:

```shell script
```console
$ nfdata create /path/to/config.create.yaml
```

Expand All @@ -53,7 +74,7 @@ The two files will be output to the paths specified in the config file.

To edit an existing NetCDF dataset, specify the "edit" option:

```shell script
```console
$ nfdata edit /path/to/config.edit.yaml
```

Expand All @@ -67,7 +88,7 @@ The Fortran namelist file cannot be edited using this method and you should inst

To simply convert a constants YAML file to a Fortran namelist file, you can use the `constants` option:

```shell script
```console
$ nfdata constants /path/to/constants.yaml -o /path/to/constants.nml
```

Expand Down
2 changes: 1 addition & 1 deletion _static/copybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ var copyTargetText = (trigger) => {
var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);

// get filtered text
let exclude = '.linenos';
let exclude = '.linenos, .gp';

let text = filterText(target, exclude);
return formatCopyText(text, '', false, true, true, true, '', '')
Expand Down
2 changes: 1 addition & 1 deletion developers/conventions.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down
2 changes: 1 addition & 1 deletion developers/io-units.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down
2 changes: 1 addition & 1 deletion developers/vs-ifort-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down
2 changes: 1 addition & 1 deletion genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
<script src="_static/copybutton.js?v=f281be69"></script>
<script src="_static/copybutton.js?v=35a8b989"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down
8 changes: 4 additions & 4 deletions getting-started/building-the-model.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down Expand Up @@ -440,12 +440,12 @@ <h1>Building the model<a class="headerlink" href="#building-the-model" title="Li
<section id="getting-the-code">
<h2>Getting the code<a class="headerlink" href="#getting-the-code" title="Link to this heading">#</a></h2>
<p>First, get a copy of the code by cloning the repo, making sure to specify <code class="docutils literal notranslate"><span class="pre">--recurse-submodules</span></code> to pull in code for the submodules in the <code class="docutils literal notranslate"><span class="pre">vendor/</span></code> directory:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nerc-ceh/nanofase.git<span class="w"> </span>--recurse-submodules
$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>nanofase
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nerc-ceh/nanofase.git<span class="w"> </span>--recurse-submodules
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>nanofase
</pre></div>
</div>
<p>If you forget the <code class="docutils literal notranslate"><span class="pre">--recurse-submodule</span></code> flag, then run the following from the repo directory:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>submodule<span class="w"> </span>update<span class="w"> </span>--init<span class="w"> </span>--recursive
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>submodule<span class="w"> </span>update<span class="w"> </span>--init<span class="w"> </span>--recursive
</pre></div>
</div>
</section>
Expand Down
14 changes: 7 additions & 7 deletions getting-started/running-the-model.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down Expand Up @@ -433,15 +433,15 @@ <h1>Runing the model<a class="headerlink" href="#runing-the-model" title="Link t
<section id="running">
<h2>Running<a class="headerlink" href="#running" title="Link to this heading">#</a></h2>
<p>The model requires a config file to run. Examples are given in the <a class="reference external" href="https://github.com/NERC-CEH/nanofase/tree/develop/config.example">config.example</a> directory. The examples are commented and should be relatively self-explanatory. Copy one of these to a new file and edit as you wish. Make sure the directories you specify for output data and logs exist, otherwise the model will fail. Then pass this config file as the first argument when calling the model executable. For example, if you have installed the model to somewhere on your path:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>mkdir<span class="w"> </span>config<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>cp<span class="w"> </span>config.example/config.example.nml<span class="w"> </span>config/my_config.nml
$<span class="w"> </span>nanofase<span class="w"> </span>config/my_config.nml<span class="w"> </span>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>mkdir<span class="w"> </span>config<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>cp<span class="w"> </span>config.example/config.example.nml<span class="w"> </span>config/my_config.nml
<span class="gp">$ </span>nanofase<span class="w"> </span>config/my_config.nml<span class="w"> </span>
</pre></div>
</div>
<p>Or if you wish to run via fpm without installing:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># Debug version</span>
$<span class="w"> </span>fpm<span class="w"> </span>@run<span class="w"> </span>--<span class="w"> </span>config/my_config.nml
<span class="c1"># Release version with optimisations</span>
$<span class="w"> </span>fpm<span class="w"> </span>@release<span class="w"> </span>--<span class="w"> </span>config/my_config.nml
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"># </span>Debug<span class="w"> </span>version
<span class="gp">$ </span>fpm<span class="w"> </span>@run<span class="w"> </span>--<span class="w"> </span>config/my_config.nml
<span class="gp"># </span>Release<span class="w"> </span>version<span class="w"> </span>with<span class="w"> </span>optimisations
<span class="gp">$ </span>fpm<span class="w"> </span>@release<span class="w"> </span>--<span class="w"> </span>config/my_config.nml
</pre></div>
</div>
<section id="input-data">
Expand Down
2 changes: 1 addition & 1 deletion getting-started/test-scenario.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<script src="../_static/copybutton.js?v=35a8b989"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=887ef09a"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
Expand Down
Loading

0 comments on commit f29c32b

Please sign in to comment.