Moving away from pickle files for model output

Aperta
#1,025 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start with the pickle writes for SS_vars.pkl, TPI_vars.pkl and model_params.pkl, and with the existing ogcore.utils.param_dump_json function, which already serializes most parameters. The open question is what to do with SciPy interpolation objects when tax_func_type is mono or mono2D. This needs a maintainer decision on the format before any code change, so it is not a newcomer task. Done means an agreed design, not a patch.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

question

We currently save model outputs (SS_vars.pkl, TPI_vars.pkl, and model_params.pkl) as pickle files. This issue is to discussing moving away from this file format -- likely towards a JSON format.

The disadvantages of pickle include:

  1. Data need to be loaded into Python.
  2. They are binary files and thus have an opaqueness that makes it difficult to view changes to elements in the data and could pose a security risk.
  3. Pickle files, particularly those saved with cloudpickle, scubas model_params.pkl, are not guaranteed to open on versions of Python they were not saved in. This can inhibit the sharing of files and the long-term storage of data.

Using a JSON format would solve these three issues. SS_vars.pkl and TPI_vars.pkl contain only dictionaries of scalars, arrays, and strings, and so are easily converted to JSON.

Model parameters can almost always be saved to JSON (e.g., as in done with ogcore.utils.param_dump_jsonfunction). The exception to this is iftax_func_type=mono(ormono2D`), in which case the tax functions are SciPy interpolation objects. I am not aware of a way to put these into JSON. Perhaps JSON can be used in general, but a pkl can be used if tax functions of these types are used?

Lingua principale
Python
Stelle
85
Fork
153
Merge medio
1g 19h
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PSLmodels/OG-Core

Tutte le issue di PSLmodels/OG-Core

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.