Datasets:

DOI:
License:
zhuwq0 commited on
Commit
da643a7
1 Parent(s): 8b10e6e

support gcloud

Browse files
Files changed (1) hide show
  1. quakeflow_nc.py +11 -4
quakeflow_nc.py CHANGED
@@ -167,6 +167,9 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
167
  ):
168
  features = datasets.Features(
169
  {
 
 
 
170
  "waveform": datasets.Array2D(shape=(3, self.nt), dtype="float32"),
171
  "phase_time": datasets.Sequence(datasets.Value("string")),
172
  "phase_index": datasets.Sequence(datasets.Value("int32")),
@@ -183,6 +186,7 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
183
  elif (self.config.name == "event") or (self.config.name == "event_train") or (self.config.name == "event_test"):
184
  features = datasets.Features(
185
  {
 
186
  "waveform": datasets.Array3D(shape=(None, 3, self.nt), dtype="float32"),
187
  "phase_time": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
188
  "phase_index": datasets.Sequence(datasets.Sequence(datasets.Value("int32"))),
@@ -224,10 +228,13 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
224
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
225
  urls = _URLS[self.config.name]
226
  # files = dl_manager.download(urls)
227
- files = dl_manager.download_and_extract(urls)
228
- # files = [f"waveform_h5/{x}" for x in _FILES]
229
- for file in sorted(files):
230
- print(file)
 
 
 
231
 
232
  if self.config.name == "station" or self.config.name == "event":
233
  return [
 
167
  ):
168
  features = datasets.Features(
169
  {
170
+ "id": datasets.Value("string"),
171
+ "event_id": datasets.Value("string"),
172
+ "station_id": datasets.Value("string"),
173
  "waveform": datasets.Array2D(shape=(3, self.nt), dtype="float32"),
174
  "phase_time": datasets.Sequence(datasets.Value("string")),
175
  "phase_index": datasets.Sequence(datasets.Value("int32")),
 
186
  elif (self.config.name == "event") or (self.config.name == "event_train") or (self.config.name == "event_test"):
187
  features = datasets.Features(
188
  {
189
+ "event_id": datasets.Value("string"),
190
  "waveform": datasets.Array3D(shape=(None, 3, self.nt), dtype="float32"),
191
  "phase_time": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
192
  "phase_index": datasets.Sequence(datasets.Sequence(datasets.Value("int32"))),
 
228
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
229
  urls = _URLS[self.config.name]
230
  # files = dl_manager.download(urls)
231
+ if "bucket" not in self.storage_options:
232
+ files = dl_manager.download_and_extract(urls)
233
+ else:
234
+ files = [f"{self.storage_options['bucket']}/{x}" for x in _FILES]
235
+ # files = [f"/nfs/quakeflow_dataset/NC/quakeflow_nc/waveform_h5/{x}" for x in _FILES][-3:]
236
+ print("Files:\n", "\n".join(sorted(files)))
237
+ print(self.storage_options)
238
 
239
  if self.config.name == "station" or self.config.name == "event":
240
  return [