How best to handle the default (Earth) radius constant
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia da cf/constants.py e mixin/fielddomain.py, quindi esamina il valore predefinito del raggio in cf.relative_vorticity e la convenzione esistente di Field.cell_area. Individua gli altri riferimenti al raggio che usano il valore del raggio terrestre e confrontane i nomi e i valori predefiniti. Il lavoro è completo quando il valore predefinito è centralizzato e i riferimenti interessati supportano in modo coerente il comportamento descritto per il raggio terrestre.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Throughout the codebase we often perform calculations using a value for the radius of a sphere. This can usually be assumed to be the Earth's because the relevant calculations concern the Earth's surface - but there may also be applications to extra-planetary atmospheres and oceans etc. so when referencing/naming the radius generally we should keep that wider scope in mind so as to not to possibly put off those wanting to do calculations for other planets.
During code review for #910 we decided to have a think about how best to handle the Earth radius default as a value that has a default to sensible precision (we use 6371229.0 meters generally), including as hard-coded at present as:
- in
mixin/fielddomain.pyas a float constant (potnetially not ideal as a float as technically that can vary very slightly by floating point precision, as a separate concern); - a
radiuskwarg value default forcf.relative_vorticity.
See thread in https://github.com/NCAS-CMS/cf-python/pull/910#discussion_r2967106221 for original discussion points.
Suggestion
I suggest that:
-
we add
earth_radius[_value]to theconstantsmodule as an integer value6371229and import there where necessary. The canonical units for it are already defined there:so it is nice to have it close to those as an additional benefit;
-
we change any
radiusreference to make sure it doesn't reference the 'Earth' in the name explicitly, but take our default Earth radius as default (the average user will be considering the Earth and surely in most cases not need to tweak the value from default precision); -
for any functions that use the default Earth radius, consult that constant - notably where there's a corresponding keyword argument
radiustake 'earth' as a string default to mean 'use the default earth value', as we presently do for many methods such asField.cell_area.
- Lingua principale
- Python
- Stelle
- 151
- Fork
- 23
- Merge medio
- 1g 2h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi 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.
Altre issue di NCAS-CMS/cf-python
-
installation
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Attempt at unsupported conservative 3D mesh regriddingForse di nuovo libera @sadielbartholomew l’ha presa 43 giorni fa e non c’è nessuna pull request aperta. Apertabug?
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
API review (4.0.0) documentation
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Testing of to/from xarrayApertaenhancement xarray
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di NCAS-CMS/cf-python
Issue simili
-
type-bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
push_gh-pages fails on master branch on forksForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagood first issue infrastructure
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
kuznia-rdzeni/coreblocks#1135 ·
-
good first issue server
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
documentation priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
a-lex-s/mealie-telegram-bot#54 ·
I maintainer di solito rispondono entro 1 giorno