Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

GST is read as Gulf Standard Time (UTC+4) instead of Guam Standard Time (UTC+10)

Aperta Adatta ai principianti
#454 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

@yang00333 ci sta già lavorando.

Dal 16/10/2026.

  • #455 di @yang00333 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
pandas, python
Ambito
data

Direzione di ricerca

Gli offset errati si trovano nella tabella delle abbreviazioni in dataretrieval/codes/timezones.py, e _build_utc_datetime in dataretrieval/_wqx.py li applica. Esegui la riproduzione della issue, che chiama _attach_datetime_columns, per vedere GST finire su +0400. Cambia GST in +1000, NZDT e FJST in +1300, e aggiungi HDT a -0900. Poi aggiungi test nello stile di #432. È completato quando la riproduzione stampa 2024-06-01 00:00:00+00:00 e i nuovi casi passano. Lascia invariate le altre abbreviazioni ambigue, a meno che un maintainer non lo chieda.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

codes.timezones puts GST on the +0400 row (Gulf Standard Time):

https://github.com/DOI-USGS/dataretrieval-python/blob/d5254bef635327765418dd590462246d4d1227df/dataretrieval/codes/timezones.py#L19

and _wqx._build_utc_datetime applies that offset when it builds the UTC column:

https://github.com/DOI-USGS/dataretrieval-python/blob/d5254bef635327765418dd590462246d4d1227df/dataretrieval/_wqx.py#L37

The USGS time-zone codes (https://help.waterdata.usgs.gov/tz) and the WQX TimeZone domain both define GST as Guam Standard Time, UTC+10. The same table feeds the *DateTime columns that wqp.get_results() and waterdata.get_samples() append, and utils.format_datetime(), so any result stamped GST is placed six hours off. (I haven't found a live response that carries GST yet; the Guam results I pulled from the Water Quality Portal have no times.)

Reproduce:

import pandas as pd
from dataretrieval._wqx import _attach_datetime_columns

df = pd.DataFrame({
    "Activity_StartDate": ["2024-06-01"],
    "Activity_StartTime": ["10:00:00"],
    "Activity_StartTimeZone": ["GST"],
})
print(_attach_datetime_columns(df)["Activity_StartDateTime"][0])
# 2024-06-01 06:00:00+00:00   expected 2024-06-01 00:00:00+00:00

Comparing the table with the USGS list turned up two smaller problems:

  • NZDT is +1330; the USGS list has UTC+13 (as does FJST, Fiji Summer Time).
  • HDT (Hawaii-Aleutian Daylight Time, UTC-9) is in the USGS list but not in the table, so it becomes NaT.

A few other abbreviations also mean different zones in the two lists (for example EAST, CCT, NFT, WAT, and SST, which the USGS list uses for Swedish Summer Time but WQX uses for Samoa). I have left those alone, since I don't know which ones actually appear in responses.

I have a small fix with tests ready for GST, NZDT/FJST, and HDT, following the pattern of #432. Happy to open a PR if that's welcome.

Python 3.11, pandas 3.0.2, dataretrieval main (d5254bef).

Lingua principale
Python
Stelle
269
Fork
67
Merge medio
4g 4h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DOI-USGS/dataretrieval-python

Tutte le issue di DOI-USGS/dataretrieval-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.