Skip to content

NOAA_GPCC_StandardardizedPrecipitation_fix#2099

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

NOAA_GPCC_StandardardizedPrecipitation_fix#2099
balit-raibot wants to merge 13 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

Changes in this PR:

  • code fix for 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.
  • increased resources as the default led to failure during validation
  • added goldens

NOTE:

  • This import has 5 sub-imports out of which only one (gpcc_spi_aggregation) has places in geoId notation, other 4 sub-imports have places in grids(lat/long) and thus no golden data for these 4 imports.
  • This import has 5 sub-imports out of which one (drought_spi_9m_polygon_events) produces an empty summary_report.csv due to its statvars in not-usual format (can be looked into later), and thus doesn't have golden check.

test env execution: https://pantheon.corp.google.com/batch/jobsDetail/regions/us-central1/jobs/noaa-gpcc-standardardizedprecipitationindex-balit-20260720-1/details?project=datcom-infosys-dev

@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

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 introduces validation configuration and golden summary reports for the GPCC SPI pipeline, updates the manifest with resource limits, and optimizes the coordinate-to-grid mapping in preprocess_gpcc_spi.py using vectorized pandas operations. Feedback on the validation configuration highlights a mismatch in the check_goldens_output_csv_gpcc_spi_aggregation rule, where the input_files parameter incorrectly references the drought events output file instead of the aggregated SPI output file.

Comment thread scripts/noaa/gpcc_spi/validation_config.json 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 introduces validation configurations and golden summary reports for NOAA GPCC SPI data, and optimizes the preprocessing script by vectorizing the grid coordinate calculation instead of using a row-wise .apply() function. Feedback suggests reducing the resource limits in manifest.json as the requested CPU, memory, and disk limits are excessively high for a standard import job.

Comment thread scripts/noaa/gpcc_spi/manifest.json
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