Skip to content

Commit 1119f81

Browse files
committed
-convert_coordinates_to_negative: fixed coords directly at speiAll_final.csv
1 parent 835a8c3 commit 1119f81

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

main.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,6 @@
33
import json
44
import os
55

6-
def convert_coordinates_to_negative(COORD):
7-
"""
8-
Return negative coordinates provided any coordinates.
9-
For example, 'X,47,95,,19,55' will be converted to 'X,-47.95,-19.55'
10-
11-
Parameters
12-
----------
13-
COORD : string
14-
Any coordinates.
15-
16-
Returns
17-
-------
18-
str
19-
The negative coordinates.
20-
21-
"""
22-
# Divide a string em partes
23-
PARTS = COORD.split(',')
24-
# Pega a latitude e longitude
25-
LATITUDE = '-' + PARTS[1] + '.' + PARTS[2]
26-
LONGITUDE = '-' + PARTS[4] + '.' + PARTS[5]
27-
# Converte para negativos e retorna no formato original
28-
return f'X,{float(LATITUDE) },{float(LONGITUDE) }'
29-
306
def define_cities_of_interest(json_source_file_name):
317
"""
328
Return the cities of interest, given a file that has this information.
@@ -161,7 +137,6 @@ def write_city_timeseries_on_xlsxs(df_cities_of_interest, df_nearest_measurement
161137

162138
# Create a dataframe to hold all SPEI measurements together with their geographical coordinates:
163139
df_SPEI = pd.read_csv("speiAll_final.csv",delimiter=';').reset_index(drop=True)
164-
df_SPEI.columns = [convert_coordinates_to_negative(col) for col in df_SPEI.columns]
165140

166141
df_cities_of_interest = define_cities_of_interest('cidades.json')
167142
print(df_cities_of_interest)

speiAll_final.csv

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)