classmodel / class-web

Web version of CLASS
https://classmodel.github.io/class-web
GNU General Public License v3.0
0 stars 0 forks source link

Add analysis cards to share link and make URLs persistent #61

Open sverhoeven opened 2 weeks ago

sverhoeven commented 2 weeks ago

Since #55 you can create a link to share an experiment. However it does not included any analysis. As a receiver of a shared link I would expect that the analysis would be part of the link.

Also what would be nice to have description/comment included that explains something about the analysis.

Peter9192 commented 1 week ago

In the EWED project, there will be a database with historic forest fires, and for each fire we would like to store a URL corresponding to the CLASS configuration for that specific case. To ensure that these URL will still be valid for future versions of CLASS, it would be nice if it was possible to store only partial configs in the URL.

To make sure a URL uniquely reproduces an old experiment, the default or preset configuration should be persistent.

sverhoeven commented 1 week ago

For example

// Content of ewedv1.json preset could like
const preset_ewedv1 = {
    $schema: 'https://classmodel.github.io/class-web/schema/class.v1.2.3.json',
    title: 'EWE DV1',
    description: 'Describe what is special about this preset',
    initialState: {
        h_0: 200,
        theta_0: 288,
        dtheta_0: 1,
        q_0: 0.008,
        dq_0: -0.001,
    },
    timeControl: { dt: 60, runtime: 43200 },
    mixedLayer: {
        wtheta: 0.1,
        advtheta: 0,
        gammatheta: 0.006,
        wq: 0.0001,
        advq: 0,
        gammaq: 0,
        divU: 0,
        beta: 0.2,
    },
}
const appState = {
    expirments: [{
        name: 'high',
        // Can be short name or url
        // Short names resolves to local presets directory which is part of a package
        // preset: 'ewedv1',
        preset: 'https://classmodel.github.io/class-web/presets/ewedv1.json', 
        description: 'High elevation. Class config for [ewed entry #1234](https://.../1234)',
        reference: {
            // Applies defaults from given json schema
            initialState: {
                h_0: 500
            }
        }, // This can be empty and does not have to include all fields
        permutations: {
            // Applies defaults from preset and from reference
            "beta2": { mixedLayer: { beta: 0.1 } },
        } // This can be empty
        // Does not contain output of a CLASS model run, run(s) will be done on load
    }],
    analyis: [{
        // ... skewT chart
    }]
}
const url = makeUrlSafe(appState)

Would be nice to have a JSON schema of the appState and export makeUrlSafe() in package so other applications can check they are giving right state in url.

Would nice to list preset links on some web page, part of webapp or docs site or README

We should minimize fetching the preset json, either use json part of package or cache it in ~/.cache/class/presets/bla.json

sverhoeven commented 2 days ago

We will need functions to combine and subtract configs in preset, reference and permutation. Some components will need a full config and others will need a partial config.

In the form we will need to pass placeholders in the JSON schema or via new prop.