Commit
·
b6712bb
1
Parent(s):
0fd1c04
Start adding video side of dataset
Browse files- eumetsat_uk_hrv.py +36 -20
eumetsat_uk_hrv.py
CHANGED
@@ -42,9 +42,7 @@ _HOMEPAGE = "https://console.cloud.google.com/marketplace/product/bigquery-publi
|
|
42 |
|
43 |
_LICENSE = "Cite EUMETSAT as the data source. This data is redistributed with permission from EUMETSAT under the terms of the EUMETSAT Data Policy for SEVIRI data with a latency of >3 hours . This redistributed dataset is released under the CC BY 4.0 open data license & is provided \"AS IS\" without any warranty, express or implied, from Google. Google disclaims all liability for any damages, direct or indirect, resulting from the use of the dataset."
|
44 |
|
45 |
-
|
46 |
-
"uk_hrv": "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v3/eumetsat_seviri_hrv_uk.zarr",
|
47 |
-
}
|
48 |
|
49 |
|
50 |
class EumetsatUkHrvDataset(datasets.GeneratorBasedBuilder):
|
@@ -53,20 +51,30 @@ class EumetsatUkHrvDataset(datasets.GeneratorBasedBuilder):
|
|
53 |
VERSION = datasets.Version("1.1.0")
|
54 |
BUILDER_CONFIGS = [
|
55 |
datasets.BuilderConfig(name="uk", version=VERSION, description="This part of the dataset covers the UK"),
|
|
|
56 |
]
|
57 |
|
58 |
DEFAULT_CONFIG_NAME = "uk" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
59 |
|
60 |
def _info(self):
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
return datasets.DatasetInfo(
|
71 |
# This is the description that will appear on the datasets page.
|
72 |
description=_DESCRIPTION,
|
@@ -84,8 +92,7 @@ class EumetsatUkHrvDataset(datasets.GeneratorBasedBuilder):
|
|
84 |
)
|
85 |
|
86 |
def _split_generators(self, dl_manager):
|
87 |
-
|
88 |
-
data_dir = dl_manager.download(urls)
|
89 |
return [
|
90 |
datasets.SplitGenerator(
|
91 |
name=datasets.Split.TRAIN,
|
@@ -112,9 +119,18 @@ class EumetsatUkHrvDataset(datasets.GeneratorBasedBuilder):
|
|
112 |
sat_data = xarray.open_dataset(filepath, engine="zarr", chunks='auto')
|
113 |
sat_data = sat_data.sel(time=time_range)
|
114 |
for key, entry in enumerate(sat_data):
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
_LICENSE = "Cite EUMETSAT as the data source. This data is redistributed with permission from EUMETSAT under the terms of the EUMETSAT Data Policy for SEVIRI data with a latency of >3 hours . This redistributed dataset is released under the CC BY 4.0 open data license & is provided \"AS IS\" without any warranty, express or implied, from Google. Google disclaims all liability for any damages, direct or indirect, resulting from the use of the dataset."
|
44 |
|
45 |
+
_URL = "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v3/eumetsat_seviri_hrv_uk.zarr"
|
|
|
|
|
46 |
|
47 |
|
48 |
class EumetsatUkHrvDataset(datasets.GeneratorBasedBuilder):
|
|
|
51 |
VERSION = datasets.Version("1.1.0")
|
52 |
BUILDER_CONFIGS = [
|
53 |
datasets.BuilderConfig(name="uk", version=VERSION, description="This part of the dataset covers the UK"),
|
54 |
+
datasets.BuilderConfig(name="uk_video", version=VERSION, description="This dataset is for video prediction")
|
55 |
]
|
56 |
|
57 |
DEFAULT_CONFIG_NAME = "uk" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
58 |
|
59 |
def _info(self):
|
60 |
+
if self.config.name == "uk":
|
61 |
+
features = datasets.Features(
|
62 |
+
{
|
63 |
+
"timestamp": datasets.Value("time64[ns]"),
|
64 |
+
"image": datasets.Array3D(shape=(1, ), dtype="int16"),
|
65 |
+
"x_coordinates": datasets.Sequence(datasets.Value("float64")),
|
66 |
+
"y_coordinates": datasets.Sequence(datasets.Value("float64"))
|
67 |
+
}
|
68 |
+
)
|
69 |
+
else:
|
70 |
+
features = datasets.Features(
|
71 |
+
{
|
72 |
+
"timestamps":datasets.Sequence(datasets.Value("time64[ns]")),
|
73 |
+
"video": datasets.Array4D(shape=(36,1, ), dtype="int16"),
|
74 |
+
"x_coordinates": datasets.Sequence(datasets.Value("float64")),
|
75 |
+
"y_coordinates": datasets.Sequence(datasets.Value("float64"))
|
76 |
+
}
|
77 |
+
)
|
78 |
return datasets.DatasetInfo(
|
79 |
# This is the description that will appear on the datasets page.
|
80 |
description=_DESCRIPTION,
|
|
|
92 |
)
|
93 |
|
94 |
def _split_generators(self, dl_manager):
|
95 |
+
data_dir = dl_manager.download(_URL)
|
|
|
96 |
return [
|
97 |
datasets.SplitGenerator(
|
98 |
name=datasets.Split.TRAIN,
|
|
|
119 |
sat_data = xarray.open_dataset(filepath, engine="zarr", chunks='auto')
|
120 |
sat_data = sat_data.sel(time=time_range)
|
121 |
for key, entry in enumerate(sat_data):
|
122 |
+
if self.config.name == "uk":
|
123 |
+
yield key, {
|
124 |
+
"timestamp": entry.time.values,
|
125 |
+
"x_coordinates": entry.x_geospatial.values,
|
126 |
+
"y_coordinates": entry.y_geospatial.values,
|
127 |
+
"image": entry.values,
|
128 |
+
}
|
129 |
+
else:
|
130 |
+
# TODO Select videos from dataset and return those
|
131 |
+
yield key, {
|
132 |
+
"timestamps": entry.time.values,
|
133 |
+
"x_coordinates": entry.x_geospatial.values,
|
134 |
+
"y_coordinates": entry.y_geospatial.values,
|
135 |
+
"video": entry.values,
|
136 |
+
}
|