Git Product home page Git Product logo

livvkit's Introduction

The land ice verification and validation toolkit

LIVVkit is a python-based toolkit for verification and validation of ice sheet models. It aims to provide the following capabilities:

Model V&V

  • Numerical verification -- "Are we solving the equations correctly?"
  • Physical validation -- "Are we using the right physics?"

Software V&V

  • Code verification -- "did we build what we intended?"
  • Performance validation -- "did we build what the users wanted?"

Within LIVVkit, these capabilities are broken into four components:

Model V&V

  • Numerics
  • Validation

Software V&V

  • Verification
  • Performance

Currently, LIVVkit is being used and developed in conjunction with E3SM (Energy Exascale Earth System Model) and CISM (Community Ice Sheet Model), but is designed to be extensible to other models. For further documentation view the full documentation.

Users and contributors are welcome! We’ll help you out – open an issue on github to contact us for any reason.

Installation

The latest LIVVkit release can be installed via pip:

pip install livvkit

Additionally, LIVVkit is released on github, and you can clone the source code:

git clone https://github.com/LIVVkit/LIVVkit.git

If you are having any troubles with installation or dependencies, open an issue on the issue tracker or contact us!

Usage

LIVVkit is primarily controlled via options specified at the command line. To see the full list of options, run:

livv -h

Verification

In verification mode, LIVVkit analyzes and compares a regression testing dataset to a reference dataset. For example, LIVVkit may analyze the dataset produced from a proposed CISM 2.0.6 release (~400MB; download here) and compare it to the dataset produced from the CISM 2.0.0 release (~400MB; download here). To run this example, first download the two aforementioned datasets to a directory, open a terminal, and navigate to your download directory. Then, un-tar the datasets:

tar -zxvf cism-2.0.0-tests.20160728.tgz
tar -zxvf cism-2.0.6-tests.20160728.tgz

For ease, export the path to the two dataset directories:

export REF=$PWD/cism-2.0.0-tests/titan-gnu/CISM_glissade
export TEST=$PWD/cism-2.0.6-tests/titan-gnu/CISM_glissade

To run the suite, use:

livv -v $TEST $REF -o cism206v200 -s

LIVVkit will run the verification suite, report a summary of the results on the command line, produce an output website in the created cism206v200 directory specified by the -o/--out-dir option, and launch an http server (the -s/--serve option) to easily view the output in your favorite web browser. LIVVkit will tell you the address to view the website at on the command line, which will typically look like http://0.0.0.0:8000/ver_test/index.html.

Validation, Extensions

LIVVkit is extensible to more in-depth or larger validation analyses. However, because these validation analyses are particularly data intensive, many of the observational and example model output files are much too large to distribute in the LIVVkit package. Therefore, we've developed a LIVVkit Extensions repository (LEX) which uses git-lfs (Git Large File Support) in order to distribute the required data. git-lfs can be installed either before or after cloning this repository, but it will be needed before downloading the required data. You can determine if you have git-lfs installed on your system by running this command:

command -v git-lfs

If git-lfs is not installed, you can install it by following the instructions here:

https://git-lfs.github.com

Once git-lfs is installed, clone and enter this repository:

git lfs clone https://code.ornl.gov/LIVVkit/lex.git
cd lex

Each extension will have an associated JSON configuration file which will describe the extension's analysis code, data locations, and options. To see a list of available extensions, you can run this command:

find . -iname "*.json"

To execute any of these extensions, point livv to any of these extensions config file via the -e/--extension option (or the -V/--validate option). For example, to run the minimal example extension, place the output website in the val_test directory, and serve the output website you'd run this command:

livv -e example/example.json -o vv_test -s

Note: All the extension configurations files assume you are working from the top level lex directory. You can run any of these extensions from any directory, but you will need to edit the paths in the JSON configuration files so that livv can find the required files.

Likewise, you can also apply these analyses to any new model run by adjusting the paths to point to your model run.

More

For more information about using LIVVkit see the documentation.

Contact

If you would like to suggest features, request tests, discuss contributions, report bugs, ask questions, or contact us for any reason, use the Issue Tracker.

Want to send us a private message?

Joseph H. Kennedy

Katherine J. Evans

If you're emailing us, we recommend CC-ing all of us.

livvkit's People

Contributors

arbennett avatar doug-ranken avatar jhkennedy avatar kevans32 avatar matthewhoffman avatar mkstratos avatar mrnorman avatar stephenprice avatar whlipscomb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livvkit's Issues

Better CSS and JS

Currently, some of our Javascript is writing in-place CSS styling for some HTML elements. Sometimes this is due to desired conditional handling of styling, but other times, it's done as a convenience for a specific problem.

Overall, it'd be better to use classes/ids for these types of issues. Also, allowing an extension to specify an extra CSS style sheet (or sheets) and providing utilities to adjust the livvkit element html classes and ids would cover most use cases.

Remove numpy from setup_requires

Previously, LIVVkit has boot-strapped the numpy install because "numpy likes to build from source and it's slow and prone to failure."

This was done through:

and then removed in 98dee78 because we expect all installs to be done via pip (or conda) now, because pip is now the (python) recommended way to install packages for all python versions.

This will need to be tested on our supported HPC machines because they typically use legacy python setups and can be troublesome.

Use dictionary upacking to merge dicts

LIVVkit provides a livvkit.util.functions.merge_dicts function to combine multiple dictionaries (e.g., for combining json files passed to the -e option on the CLI).

This function can be dropped for generalized dictionary unpacking via PEP 448, which is available from python 3.5 on, once python 2 support has been dropped.

Provide an "extensions" component

With the development of Atlas, it looks like LIVVkit extensions may defy neat classification into validation or numeric as we anticipated. Adding a -e/--extension option, and possibly a more generalized extensions component, would enhance the livv interface.

Refactor LIVVkit elements

Jupyter notebooks can render custom html if a class implements the _repr_html method. If the element definitions were refactored as objects they could include _repr_html methods which would just call the relevant javascript functions inside a script tag.

If this was done I think the TeX helper module could be merged into the main element subclasses as well.

@jhkennedy I just randomly had this idea after learning about _repr_html and figured I'd throw it out there. Feel free to close if you don't think it's a good/feasible addition.

Performance fail gracefully

When LIVVkit's performance component can't find enough data, it doesn't always fail gracefully and sometimes produces errors like:

 -----------------------------------------------------------------
   Beginning performance test suite 
 -----------------------------------------------------------------

Process Process-14:
Traceback (most recent call last):
  File ".../lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File ".../lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File ".../lib/python2.7/site-packages/livvkit/components/performance.py", line 89, in _run_suite
    os.path.join(plot_dir, case + "_weak_scaling_efficiency.png")
  File ".../lib/python2.7/site-packages/livvkit/components/performance.py", line 387, in weak_scaling_efficiency_plot
    case_data['means'] = (means[0] / means) * 100
IndexError: index 0 is out of bounds for axis 0 with size 0

These kind of errors should be handled.

Refactor output writer

With the refactor of LIVVkit elements to classes, the LIVVkit output should become a class containing all the output elements, and have methods to write the output for the different output representations (HTML, JSON, LaTeX, etc.).

Also, this would allow for multiple outputs to be combined (see #49) easily as long as the JSON data is preserved -- every output should also include the JOSN data.

Use importlib to allow sub packages to be imported without adding to the system path

As of f6495d9 LIVVkit is able to import packages that may look like:

EXT_DIR
    -- ext.py
    -- SUB_PACKAGE
        -- __init__.py
        -- f1.py
        -- f2.py

but importlib won't import SUB_PACKAGE from within ext.py without adding EXT_DIR to the system path.

This could lead to clashes for same-named packages and clutters the system path.

The current workaround is to add EXT_DIR to the path until the all the needed imports are complete, and then removes them from the system path.

There should be a better way to do this.

Big documentation clean up.

There are some inconsistencies and missing information in the wiki that should be cleaned up pre-release.

Note: I'm working on these -- using this issue to keep track, and solicit input as needed.

[ ] Discussion of verification and validation in general:

  • Terminology is a little mixed up -- need to go decide what we mean by code verification, code validation, performance validation, and scientific validation
  • Code Validation section refers to what things done in our verification code. This is inconsistent.

[ ] User workflow

  • Basic workflow for users -- perform an initial verification of install from benchmark data

[ ] Devloper workflow

  • perform code verification, code validation, and performance validation across commits (pull requests)

[ ] Scientist workflow

  • perform scientific validation, possibly in conjunction with performance validation (This is easy, as we don't currently have this capability)

[ ] include a development road map which describes our developmental goals.

LIVVkit must run tests to launch http server

The ability to fire up an http server to aid in viewing of the output website was recently added. However, this requires a test to be run and therefore can't be fired up to look at previously generated websites.

Although firing up an http server is a single command line command with python, and documented in the LIVVkit FAQs, it would make sense for this option to be available for previously generated websites.

Calendar functionality

ISMs and ESMs may use a variety of calendars for time-referencing model input and output data. For example, ESMF can be used in ACME/CESM to provide these calendars:

  • 360 day
  • Gregorian
  • Julian
  • Julian Day
  • etc.

The datetime module in the python standard library performs calculations natively in the Gregorian calendar and provides an ISO calendar, but doesn't provide other calendars.

Extention module import failures

Extensions modules can fail to be imported because:

  1. Module could not be found
  2. Problems within the module like bad syntax or missing dependencies

LIVVkit assumes 1 on failure to import, but 2 is also very likely to happen as extensions may have additional dependencies.

Need to account for 2 in in LIVVkit.

ConfigParser clobbers repeated sections in CISM configuration files.

From @jhkennedy on May 26, 2016 19:25

CISM allows repeated sections with identical names in its configurations files:

[CF output]
variables = thk usurf topg bheatflx acab uvel vvel wvel temp beta iarea iareag iareaf ivol rho_ice artm flwa    
name = GIS.8km.Const.4Albany.2D.out.nc
frequency = 5.0

[CF output]
variables = iarea iareag iareaf ivol rho_ice    
name = GIS.8km.Const.4Albany.SC.out.nc
frequency = 1.0

These repeated [CF output] section each setup an individual data 'pipe' [ish] which creates it's own output file.

ConfigParser will clobber these when loading the file, and only one section will be output.

Note: the output may even be a mix match of values from the multiple section as these sections are not ordered either.

We will need to move to a parser which can handle non-unique section names.


@arbennett pointed out we may be able to make a custom dictionary type which ConfigParser can use to provide this functionality:

https://stackoverflow.com/questions/9876059/parsing-configure-file-with-same-section-name-in-python

It would be preferable to create a solution which will allow ConfigParser to read as well as write CISM config files. That way a solution is available for writing python run scripts which take in and modify a base configuration file before running (i.e., all the CISM tests).

For asthetic reasons, it would also be nice to keep the sections order when reading and writing the files.

The custom dict would need to:

  • Allow ConfigParser to read and store repeated sections
  • Allow ConfigParser to write files with repeated sections
  • Maintain the section order from read to write

Copied from original issue: ACME-Climate/LIVV#59

Change labeling of bench and test to historical and current

From @arbennett on July 29, 2016 19:49

Other possibilities are now and past, or current and reference. In any case, benchmark as a term carries a whole bunch of baggage with it that isn't appropriate for some of our comparisons. Similarly, test is used way too frequently for a bunch of things so something else would be better.

Copied from original issue: ACME-Climate/LIVV#80

Use pathlib

Python 3.6+ natively uses pathlib, an object-oriented approach to paths and filenames. This is recommended as it replaces most of the "cumbersome" code from os.path and glob.glob (which use "dumb" string manipulation).

While the module pathlib2 is available lower python versions, there isn't guaranteed support in associated packages (numpy, scipy, etc) as there is in Python 3+ versions.

Therefore, this should happen in tandem with dropping python 2 support.

Provide a LatexHelper class

From @arbennett on July 29, 2016 18:29

It would be nice if we could provide Latex output alongside the web output. A straightforward way to do this would be to have a new class LatexHelper that would have functions to translate the results of the ElementHelper class's functions from Python dictionaries into the relevant Latex code.

Copied from original issue: ACME-Climate/LIVV#77

Provide generalized way of handling different shaped datasets for plotting

From @arbennett on February 18, 2016 6:6

Previously when handling data we had hardcoded ways of formatting. For example, with bit for bit processing there were two main variables with different shapes:

  • Velocity - (layer, time, x, y)
  • Thickness - (layer, x, y)

When extracting this data from a NetCDF file it just becomes a Numpy array with those shapes. To have smarter handling of this will make it easier to do plotting without resorting to breaking out different variables explicitely. This also seems to be a good situation to put into a model-specific bundle so that intercomparison tests will be possible when we have regridding infrastructure.

Copied from original issue: ACME-Climate/LIVV#48

Allow multiple output websites to be combined

It would be nice to be able to take multiple output websites, and combine them into a single portable website.

There should be a safe method, where nothing is overwritten if the combining sites have the same output pages, and an merge method that overwrites repeated output with some selected priority (newest? user specified?).

Also, some decisions will need to be made about how the summary/index page is handled...

Test description from docstring if missing in config

From @jhkennedy on April 19, 2017 17:2

Currently, the displayed description for a test comes from the display item in the tests config file. For tests with many cases, this provides a nice way to describe each case.

However, for tests that do not have many cases, or will always have the same description, it would make sense to pull the displayed description from the __doc__ string in the test module (prevent duplication of text, making it easier to maintain).

This could be implemented by using the display item from the config file, and falling back to the __doc__ string if no display item exists.

Copied from original issue: ACME-Climate/LIVV#85

Extension import method doesn't allow for package import

LIVVkit's method to import extension modules doesn't allow for extension "packages" which have multiple *.py files (likely in a directory structure). For example, an extension may look like:

    EXT_DIR
       -- ext.json
       -- ext.py
       -- SUB_PACKAGE
            -- __init__.py
            -- f1.py
            -- f2.py

Currently, only ext.py can be imported.

One solution is to add EXT_DIR to sys.path, but this may lead to unintentional package conflicts (e.g., same SUB_PACKAGE names).

Pin json_tricks version

The json_tricks API changed between versions 3.8 and 3.11 and depreciated the json_tricks.np.dumps module in favor of always being numpy compatible and only using json_tricks.nonp.dumps when that feature isn't wanted.

See: http://json-tricks.readthedocs.io/en/latest/

We should:

  • Update LIVVkit to use the new API
  • Pin the json_tricks version b/c they like to break backwards compatibility

Parse stderr for known errors

From @jhkennedy on February 19, 2016 17:54

An bug was discovered in CISM ( ACME-Climate/cism-piscees#50 ) which resulted in the error message

newchild: child tstep can't be a parent of itself

being printed to stderr, but the test otherwise ran successfully.

LIVV doesn't currently check the stderr output from the tests (`*.config.oe) for any known errors.

We could either:

  • parse the *.config.oe for any known errors

or

  • split *.config.oe into individual files for stdout and stderr and then check to see if there is anything in the stderr file.

LIVV should then report these errors on a test's page.

Copied from original issue: ACME-Climate/LIVV#49

Chrome not displaying javascript elements locally

From @jhkennedy on March 31, 2017 16:1

Chrome, on both my linux and mac, will not display the Javascript elements of the output webpages when viewed on the local file system. However, Firefox and Safari will display everything correctly (have not tested IE).

To reproduce, download this output website (cism206v200.tar.gz), untar, and see if you can view the elements on cism206v200/index.html with Chrome and Firefox.

Interestingly, once the output site is made accessible on the internet, Chrome does display everything correctly. See here.

Copied from original issue: ACME-Climate/LIVV#83

Add element for V-H Table

Currently, there is a js method to render a table with both vertical and horizontal headers (V-H Table), but there is no associated LIVVkit element.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.