@@ -399,12 +399,12 @@ def geographic_percentajes(df):
399399 Geographic: 63.45%
400400 {'Geographic': 63.45, 'Coordinates': 25.6, 'Countries': 15.2, 'CoordinatesUncertainty': 18.9, 'IncorrectCoordinates': 3.75}
401401 """
402- __BD_BORDERS = gpd .read_file (gpd .datasets .get_path ("naturalearth_lowres" ))
403- # Total de ocurrencias
404- total_data = len (df )
405-
406- # Porcentaje de ocurrencias con coordenadas válidas (latitud y longitud presentes)
407402 try :
403+ __BD_BORDERS = gpd .read_file (gpd .datasets .get_path ("naturalearth_lowres" ))
404+ # Total de ocurrencias
405+ total_data = len (df )
406+
407+ # Porcentaje de ocurrencias con coordenadas válidas (latitud y longitud presentes)
408408 percentaje_coordinates = (
409409 len (df [df ["decimalLatitude" ].notnull () & df ["decimalLongitude" ].notnull ()])
410410 / total_data
@@ -459,13 +459,15 @@ def geographic_percentajes(df):
459459 percentaje_incorrect_coordinates = 0
460460
461461 # Porcentaje total de calidad geográfica combinando los porcentajes ponderados
462- percentaje_geographic = (
463- 0.2 * percentaje_coordinates
464- + 0.1 * percentaje_countries
465- + 0.05 * percentaje_coordinates_uncertainty
466- - 0.2 * percentaje_incorrect_coordinates
467- ) / 0.35
468-
462+ percentaje_geographic = 0
463+ try :
464+ percentaje_geographic += 0.2 * percentaje_coordinates
465+ percentaje_geographic += 0.1 * percentaje_countries
466+ percentaje_geographic += 0.05 * percentaje_coordinates_uncertainty
467+ percentaje_geographic -= 0.2 * percentaje_incorrect_coordinates
468+ percentaje_geographic = percentaje_geographic / 0.35
469+ except Exception as e :
470+ logging .error (e )
469471 return {
470472 "Geographic" : percentaje_geographic ,
471473 "Coordinates" : percentaje_coordinates ,
0 commit comments