npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@classmodel/class

v0.0.13

Published

Chemistry Land-surface Atmosphere Soil Slab (CLASS) model

Downloads

230

Readme

@classmodel/class package

github repo badge Code quality npmjs.com Checked with Biome Research Software Directory Badge Documentation

This is an implementation of the Chemistry Land-surface Atmosphere Soil Slab (CLASS) model that runs entirely in the browser or any Javascript runtime like NodeJS.

For more information on CLASS, see https://classmodel.github.io/.

Web application

The CLASS web application that uses this package is available at https://classmodel.github.io/class-web.

Command line usage

The class model can be run from the command line.

# Generate default config file
pnpx @classmodel/class generate --output config.json

# Run the model
pnpx @classmodel/class run config.json
# Outputs h variable for each timestep in JSON format

# To output csv use
pnpx @classmodel/class run --output output.csv --formtat csv config.json

# To read from stdin use
cat config.json | pnpx @classmodel/class -

If you do not have pnpx installed you can use npx instead.

In development use pnpx tsx src/cli.ts ./config.json.

To use the reference configuration of a experiment downloaded from the web application extract it with jq using

jq .reference < ~/Downloads/class-MyExperiment.json  > config.json

Package usage

Install with

pnpm install @classmodel/class

Run model with default config use

import { runClass } from "@classmodel/class/runner";
const config = {}
const output = runClass(config)
console.log(output)

Developers

This package is part of a monorepo with other packages and applications.

JSON schema

The Class model uses a JSON schema to validate the input configuration. The schema is defined in the @classmodel/class package and can be found at src/config.json (in repo). The schema is used to validate the input configuration and to generate a form to input the configuration.

The src/config.ts file contains the embedded JSON schema and its Typescript type definition. When runnning pnpm dev or pnpm build the src/config.ts file is generated from the src/config.json file.

To manually generate the src/config.ts file run the following command:

pnpm json2ts

Linter

To check types, you can run the pnpm typecheck command as other commands ignore types.

Tests

The unit tests are written with node:test and node:assert.

The unit tests can be run with the following command:

pnpm test

To get test coverage

# Does not work via pnpm script so need to call node directly
node --import tsx --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info src/*.test.ts
# To generate a html report use genhtml which is part of lcov OS package
genhtml lcov.info --output-directory coverage

API Documentation

The API documention of the package can be generated with

pnpm run docs

Which will write HTML files to docs/ directory.

The documentation of the latest release is published at https://classmodel.github.io/class-web/docs/.