Skip to content

Commit

Permalink
🎨 Improve OOP Logic, DRYyed the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo S.A. Batista committed Nov 30, 2023
1 parent 00920a9 commit 039017a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extracao/estacoes.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def _simplify_sources(df):

@staticmethod
def _remove_invalid_frequencies(df):
df['Frequência'] = df['Frequência'].astype('float')
df.sort_values(['Frequência', 'Latitude', 'Longitude'], ignore_index=True, inplace=True)
return df[df['Frequência'] <= LIMIT_FREQ]
# TODO: save to discarded and log
Expand All @@ -270,6 +271,7 @@ def _format(
df = merge_on_frequency(anatel, aero)
df = self.validate_coordinates(df)
df = Estacoes._simplify_sources(df)
df = SRD._format_types(df)
df = Estacoes._remove_invalid_frequencies(df)
df = SRD._format_types(df)
df = df.astype('string', copy=False).replace('-1.0', '-1').astype('category', copy=False)
return df.loc[:, self.columns]

0 comments on commit 039017a

Please sign in to comment.