Skip to content

NOAA_GPCC_StandardardizedPrecipitation_fix#2099

Open
balit-raibot wants to merge 6 commits into
datacommonsorg:masterfrom
balit-raibot:NOAA_GPCC_StandardardizedPrecipitationIndex_fix
Open

NOAA_GPCC_StandardardizedPrecipitation_fix#2099
balit-raibot wants to merge 6 commits into
datacommonsorg:masterfrom
balit-raibot:NOAA_GPCC_StandardardizedPrecipitationIndex_fix

Conversation

@balit-raibot

@balit-raibot balit-raibot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This PR is to fix the failure in NOAA_GPCC_StandardardizedPrecipitation as the code is using 0/1 index to access the data frame which is somehow not able to be rendered successfully.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the preprocessing script for GPCC SPI by passing 'raw=True' to the pandas 'apply' function to improve performance. The reviewer suggested a further optimization to fully vectorize the coordinate transformation logic, which would avoid the sequential row processing of 'apply' and significantly speed up execution on large datasets.

Comment thread scripts/noaa/gpcc_spi/preprocess_gpcc_spi.py Outdated
@balit-raibot

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the slow .apply() row-wise operation with a vectorized pandas implementation to format latitude and longitude coordinates into a 1-degree grid, removing the obsolete to_one_degree_grid_place helper function. The feedback suggests adding back explanatory comments about the coordinate transformation logic that were lost during the refactoring to ensure the code remains maintainable.

Comment thread scripts/noaa/gpcc_spi/preprocess_gpcc_spi.py Outdated
@balit-raibot

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the coordinate-to-grid conversion in preprocess_gpcc_spi.py by removing the helper function to_one_degree_grid_place and vectorizing the operation directly on the DataFrame using pandas operations, which improves performance. A review comment suggests wrapping the long string concatenation expression in parentheses to avoid breaking the .astype(str) call across lines, aligning with PEP 8 guidelines for better readability.

Comment thread scripts/noaa/gpcc_spi/preprocess_gpcc_spi.py Outdated
balit-raibot and others added 2 commits July 16, 2026 22:20
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant