Gathering detailed insights and metrics for @classmodel/class
Gathering detailed insights and metrics for @classmodel/class
Gathering detailed insights and metrics for @classmodel/class
Gathering detailed insights and metrics for @classmodel/class
npm install @classmodel/class
Typescript
Module System
Min. Node Version
Node Version
NPM Version
73.9
Supply Chain
99
Quality
87.3
Maintenance
100
Vulnerability
81.3
License
TypeScript (64.9%)
Jupyter Notebook (32.24%)
JavaScript (1.71%)
CSS (1.06%)
HTML (0.1%)
Total Downloads
1,443
Last Day
1
Last Week
2
Last Month
65
Last Year
1,443
GPL-3.0 License
492 Commits
5 Watchers
9 Branches
5 Contributors
Updated on Jun 06, 2025
Latest Version
0.3.0
Package Id
@classmodel/class@0.3.0
Unpacked Size
165.99 kB
Size
41.27 kB
File Count
59
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 06, 2025
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-84.6%
2
Compared to previous week
Last Month
-39.3%
65
Compared to previous month
Last Year
0%
1,443
Compared to previous year
3
4
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/.
The CLASS web application that uses this package is available at https://classmodel.github.io/class-web.
The class model can be run from the command line.
1# Generate config file with default values 2pnpx @classmodel/class generate -o config.json 3# Or download one of the presets from 4# https://github.com/classmodel/class-web/tree/main/apps/class-solid/src/lib/presets 5 6# Edit the config file 7 8# Run the model 9pnpx @classmodel/class run config.json 10# Outputs h variable for each timestep in JSON format 11 12# To output csv use 13pnpx @classmodel/class run --output output.csv --format csv config.json 14 15# To read from stdin use 16cat config.json | pnpx @classmodel/class - 17 18# To get the JSON schema of the config file use 19pnpx @classmodel/class schema -o config.schema.json
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
1jq .reference < ~/Downloads/class-MyExperiment.json > config.json
Install with
1pnpm install @classmodel/class
Run model with default config use
1import { runClass } from "@classmodel/class/runner"; 2const config = {} 3const output = runClass(config) 4console.log(output)
This package is part of a monorepo with other packages and applications.
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.ts (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.
See the form package for additional keywords in the JSON schema.
To allow for some properties to be only defined and required when another property is true.
We use the if/then/else
syntax. The if
block should refer to a property in the main properties object.
The then
block can define additional properties that are required when the if
property is true.
See existing Config type in src/config.ts
file on how to define the TypeScript type of a new if/then/else
block.
To check types, you can run the pnpm typecheck
command as other commands ignore types.
The unit tests are written with node:test and node:assert.
The unit tests can be run with the following command:
1pnpm test
To get test coverage
1# Does not work via pnpm script so need to call node directly 2node --import tsx --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info src/*.test.ts 3# To generate a html report use genhtml which is part of lcov OS package 4genhtml lcov.info --output-directory coverage
The API documention of the package can be generated with
1pnpm 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/.
This project includes code that was generated with the assistance of a language model (LLM). All code generated by the LLM has been reviewed by the development team.
No vulnerabilities found.