From 9b246adb8c67f8169d11aa2e3128d802d4570f8e Mon Sep 17 00:00:00 2001 From: Alessandro Frigeri <alessandro.frigeri@inaf.it> Date: Fri, 10 May 2019 10:17:02 +0200 Subject: [PATCH] added example --- examples/specimens_weight.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples/specimens_weight.py diff --git a/examples/specimens_weight.py b/examples/specimens_weight.py new file mode 100644 index 0000000..7e446da --- /dev/null +++ b/examples/specimens_weight.py @@ -0,0 +1,37 @@ +import moondb,sys + + +# Get all the scientific missions held in MoonDB +moon_missions = moondb.get_missions() + +weight_cum = 0 +for m in moon_missions: + s = moondb.SpecimenFilter() + s.missionName = [ m.name ] + res = s.get_results() + weight = 0 + for r in res: + if r.weight is not None: + weight += float(r.weight.split(' ')[0]) + weight_cum += weight + print("MoonDB holds {:.3f} kg of specimens from {}".format(weight/1000.0,m.name)) + +print("MoonDB contains a total of {:.3f} kg of specimen from the Moon!".format(weight_cum/1000.0)) + + +f = moondb.AnalysisFilter() +f.mission = ["Apollo 11"] +f.analyte = ["Na2O","CaO"] +f.specimenType = ["SOIL"] + + + +results = f.get_results() + +for r in results: + for dr in r.dataResults: + print(dr) + #print(dr.laboratory,dr.variable,dr.value,dr.unit) + + + -- GitLab