Skip to content
Open
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3fd712b
fixed dataframe columns rendering in NOAA_GPCC_StandardardizedPrecipi…
balit-raibot Jul 16, 2026
a119168
fixed dataframe columns rendering in NOAA_GPCC_StandardardizedPrecipi…
balit-raibot Jul 16, 2026
1e8a3f4
adding comments
balit-raibot Jul 16, 2026
0a977e2
adding comments
balit-raibot Jul 16, 2026
3ea1374
Update scripts/noaa/gpcc_spi/preprocess_gpcc_spi.py
balit-raibot Jul 16, 2026
870cf15
adding comments
balit-raibot Jul 16, 2026
04b768d
adding goldens for NOAA GPCC
balit-raibot Jul 20, 2026
f783290
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Jul 20, 2026
eec13d3
adding goldens for NOAA GPCC
balit-raibot Jul 20, 2026
bfbf135
Merge branch 'NOAA_GPCC_StandardardizedPrecipitationIndex_fix' of htt…
balit-raibot Jul 20, 2026
96f803c
adding goldens for NOAA GPCC
balit-raibot Jul 20, 2026
272ee9a
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Jul 21, 2026
4634ea5
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Jul 21, 2026
6fb0852
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Aug 5, 2026
0c541ec
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Aug 9, 2026
5dd7a86
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Aug 10, 2026
e4c1253
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Aug 12, 2026
1aff0c3
Merge branch 'master' into NOAA_GPCC_StandardardizedPrecipitationInde…
balit-raibot Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions scripts/noaa/gpcc_spi/preprocess_gpcc_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@
'Dash separated start date. Defaults to the running date.')


def to_one_degree_grid_place(latlon):
"""Latlng data to grid format.

Change longitude from 0 ~ 360 scale to -180 ~ 180 scale.
Change coordinate from middle of the grid to north west point of the grid.
"""
return f'grid_1/{math.floor(latlon[0])}_{math.floor((latlon[1]+180)%360 - 180)}'


def nc_to_df(nc_path, period, spi_col, start_date, end_date):
"""Read a netcdf and parse to df."""
logging.info(f"Read a netcdf file - {nc_path} and parse to df.")
Expand All @@ -79,7 +70,9 @@ def nc_to_df(nc_path, period, spi_col, start_date, end_date):
df['period'] = f'"[{int(period)} dcs:Monthly]"'
# Adding observation period in output csv
df['observationPeriod'] = f'P{int(period)}M'
df['place'] = df[['lat', 'lon']].apply(to_one_degree_grid_place, axis=1)
lat_floor = (df['lat'] // 1).astype(int)
lon_floor = (((df['lon'] + 180) % 360 - 180) // 1).astype(int)
df['place'] = 'grid_1/' + lat_floor.astype(str) + '_' + lon_floor.astype(str)
Comment thread
balit-raibot marked this conversation as resolved.
Outdated
df = df.drop('lat', axis=1)
df = df.drop('lon', axis=1)
return df
Expand Down
Loading