Is it possible to get a domain summary (aka bounding box) in a simpler way that the following?
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 150
- Fork
- 23
- Merge medio
- 1g 11h
- PR unite (30g)
- 2
Descrizione
def domain_summary(f):
""" For a given field and it's domain, get a domain summary """
#FIXME: should be outer edge of bounds, and I am not sure about the coords and ancils, is that sufficient?
coords = [serialise(cf.Data.concatenate([b.min(), b.max()])) for b in [a.data for k,a in f.domain.dimension_coordinates().items()]]
ancils = [serialise(cf.Data.concatenate([b.min(), b.max()])) for b in [a.data for k,a in f.domain.auxiliary_coordinates().items()]]
bbox = coords+ancils
methods = get_cell_methods(f)
return bbox, methods
In doing this I'm making use of the following stub for serialising a data object, e.g. to pass to another application using json (is there a better way to do this)?
def serialise_data(o):
units = str(o.Units)
values = o.array.squeeze()
shape = o.array.shape
if len(values) == 1:
values = float(values[0])
else:
values = values.tolist()
return {'units': units, 'values': values, 'shape': shape}
def serialise(object):
methods = {
"<class 'cf.data.data.Data'>": serialise_data
}
otype = str(type(object))
if otype in methods:
return methods[otype](object)
else:
return ValueError(f'Cannot serialise {otype}')
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando la funzione domain_summary e il suo utilizzo di dimension_coordinates(), auxiliary_coordinates(), dei metodi di cell e dello stub serialise_data. Chiarisci con i manutentori del progetto quale debba essere il contenuto previsto della bounding box e la sua rappresentazione JSON prima di modificare l’API; il lavoro sarà completo quando esisterà un modo più semplice e concordato per ottenere e serializzare il riepilogo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- data
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100