Here you will find the sources for neXtSIM_DG sea-ice model.
Installation instructions can be found here.
Below are some conventions that every contributors to this model must apply in order to have the most efficient and consistent workflow for the model developments. These conventions deal with :
For neXtSIM_DG we use clang-format and the Webkit style, with a 100 character line length limit.
clang-format
version 18A dedicated clang format file has been designed for the code. You may run it locally and manually with the command clang-format -i $yourfile
or have a plugin with your favorite code editor or implement a git pre-commit hook locally by putting this pre-commit file in your .git/hooks/. An example pre-commit file can be found at .pre-commit. This clang formatting will also be run each time a pull request is done as part of the continuous integration.
The automatic generation of documentation is done with Doxygen and Sphinx. The update of the documentation each time the code is modified is done with readthedocs and github actions.
In order to have the most understandable and consistent documentation of the API, we expect that contributors to neXtSIM write some comments alongside their code for every C++ component (namespaces, types, methods, functions, and constants) they implement.
Every file must begin with :
Example :
/*!
* @file gridoutput.hpp
* @author Einar Olason <einar.olason@nersc.no>
* @date Thu Aug 4 09:47:27 CEST 2016
*/
Note that the example pre-commit file mentioned above will also automatically update this if moved to .git/hooks/pre-commit
.
We ask every coders to follow the following commenting conventions for comments providing the automatic documentation:
/*!
or //!
/*!
and end with */
on their own line,//!
,//!<
,@see
or @param
and Markdown for formatting.Comments starting with //
or /*
won’t appear in the automatic documentation so they can be used for internal or development comments.
The structure of a documentation block for classes and functions should be organized as follow :
Examples :
/*!
* Sum numbers in a vector.
*
* @param values Container whose values are summed.
* @return sum of `values`, or 0.0 if `values` is empty.
*/
double sum(std::vector<double> & const values) {
...
}
/*!
* Compute an element-wise cosine.
*
* @see sin
* @see tan
* @see [numpy.vectorize](https://docs.scipy.org/doc/numpy/reference/generated/numpy.vectorize.html)
*/
vector<double> cos(vector<double> const & angles);
/*!
* This is an amazing function! For example:
*
* auto cosines = cos(angles);
*
* Comment explaining the second example.
*
* auto cosines = cos(radians(angles));
*/
/*!
* Supported coordinate systems for flux-conserving transformations.
*
* These values are used in arguments to various functions in this package.
* Unless otherwise stated, these functions do not validate whether the data
* set makes sense in the "from" coordinates.
*/
enum class CoordType
{
PIXEL, //!< Untransformed detector coordinates
WARP_PIXEL, //!< Distortion-corrected detector coordinates
SKY_WCS //!< Equatorial J2000.0 coordinates
};
/*!
* Read an image from disk.
*
* @param fileName the file to read. Must be either absolute or relative to
* the program working directory.
*
* @return the image stored in `fileName`. If the image on disk does not
* have `double` pixels, they will be cast to `double`.
*
* @throws IoError Thrown if `fileName` does not exist or is not readable.
*
* @exceptsafe Strong exception guarantee.
*/
lsst::afw::image::Image<double> loadImage(std::string const & fileName);
The comments providing automatic documentation should be supplemented with ordinary explanatory and internal comments using the standard comment syntax of /*
and //
. These will not be picked up by the automatic documentation and can take a more general format.
Two types of documentation are maintained alongside the code :
We use a derived version of semantic versioning. In brief this means the main branch has a version number assigned (tagged) to each commit. The numbers are of the form x.y.z, where we:
For the code we adopt the following system for branching and merging:
<NNN>_<short_heading>
: feature branches to develop significant components. Related to one or more issues, which should be linked to the relevant draft pull request (NNN = draft pull request number). Long living. Branched from, regularly updated from and merged back into develop.<NNN>_<short-heading>
: issue specific branches (NNN = issue number). Main working area. Short living. Branched from, and merged back into develop or a feature branch.<NNN>_<short-heading>
: branches that are specific to a hotfix issue. Hotfixes are bugfixes on main that should be fixed as soon as possible.Note :
If you discover a bug check that no one else has reported the same issue on https://github.com/nextsimdg/nextsimdg/issues. If the bug has not been reported, create an issue and assign someone to fix it (possibly yourself). Please notify people in person if you're assigning issues to them.
If you would like to suggest an improvement or a new feature check that no one else has made a similar request on https://github.com/nextsimdg/nextsimdg/issues. If this is not the case create a new issue, assigning or mentioning anyone you think could be affected or interested by your suggestion.
If you have been assigned an issue on https://github.com/nextsimdg/nextsimdf/issues address it using the following steps. For issues requiring a hotfix (bugs on the main branch that should be fixed as soon as possible):
<NNN>_<short-heading>
where NNN is the issue number from GitHub. This will be the main (short living) working area.git tag LABEL
.git tag -l
.For issues not requiring a hotfix (less urgent bug-fixes and feature requests):
<NNN>_<short-heading>
where NNN is the issue number from GitHub. This will be the main (short living) working area.