Esempio n. 1
0
import sys

sys.path.append("../")
from autecology_xml import AutecologyXML

xmltest = AutecologyXML(
    filename="../../../_knowledgerules/species/Macrophytes/Chara_spp.xml")
xmltest._readxml()
print(type(xmltest.xmlroot))
xmltest._scan()
testext = xmltest._read_topicdescription()
print(type(testext))
xmltest._scan_modeltype("HSI")
xmltest._scan_knowledgerules(modeltypename="HSI", systemname="Markermeer")
print(all(elem in xmltest.XMLconvention["allowed_knowledgeRulesCategories"] for elem \
         in xmltest.knowledgeRulesCategories))

print(xmltest.knowledgeRulesNames)
print(xmltest.knowledgeRulesCategories)
print(xmltest.XMLconvention["allowed_knowledgeRulesCategories"])
fb_tag = xmltest.get_element_formula_based(modeltypename="HSI",
                                           systemname="Markermeer",
                                           fbname="P_Chara_visibility")
fb_data = xmltest.get_data_formula_based_data(fb_tag)

print(fb_data)
print(fb_data['parameters'])
print(fb_data['parameters'][0]['data'])
print(type(fb_data))

fb_settings = {
Esempio n. 2
0
				validation_log.append(["Not valid : " + path_xml_file])
				continue

			#load the xml file
			try:
				xmltest = AutecologyXML(filename = path_xml_file)
				xmltest._readxml()
				xmltest._scan()
			except:
				validation_log.append(["XML could not be read with AutecologyXML : " + path_xml_file]) 
				continue

			#CHECK languages Names and descriptions
			cur_species_commonnames = xmltest.commonnames
			cur_species_commonname_LANG = sorted([line["language"] for line in cur_species_commonnames])
			cur_species_descriptions = xmltest._read_topicdescription()
			cur_species_description_LANG = sorted([line["language"] for line in cur_species_descriptions])

			if(cur_species_commonname_LANG != cur_species_description_LANG):
				miss_common_name = (set(cur_species_description_LANG).difference(cur_species_commonname_LANG))
				miss_species_description =  (set(cur_species_commonname_LANG).difference(cur_species_description_LANG))
				if(len(miss_common_name) != 0):
					validation_log.append(["Missing language in SpeciesDescription :" +  str(miss_common_name) +". File : " + path_xml_file])
				elif(len(miss_species_description) != 0):
					validation_log.append(["Missing language in CommonNames :", str(miss_species_description) +". File : " + path_xml_file])
				else:
					validation_log.append(["Someting wrong between languages SpeciesDescription and CommonNames, please investigate : " + path_xml_file])
			
			for cur_modeltype in xmltest.modeltypes:
				#check scan of XML modeltypes
				try: