Upload 5 files
Browse files- earth_climate_preview.png +3 -0
- earth_data_api.py +64 -0
- earth_data_processed_pack.tar.zst +3 -0
- earth_structure_preview.png +3 -0
- manifest.json +141 -0
earth_climate_preview.png
ADDED
|
Git LFS Details
|
earth_data_api.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Small API for the processed earth_data_pack.h5 file."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import h5py
|
| 6 |
+
import numpy as np
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class EarthDataPack:
|
| 10 |
+
def __init__(self, path: str | Path):
|
| 11 |
+
self.path = Path(path)
|
| 12 |
+
self.h5 = h5py.File(self.path, "r")
|
| 13 |
+
self.aligned = self.h5["aligned"]
|
| 14 |
+
|
| 15 |
+
def close(self) -> None:
|
| 16 |
+
self.h5.close()
|
| 17 |
+
|
| 18 |
+
def __enter__(self):
|
| 19 |
+
return self
|
| 20 |
+
|
| 21 |
+
def __exit__(self, exc_type, exc, tb):
|
| 22 |
+
self.close()
|
| 23 |
+
|
| 24 |
+
@property
|
| 25 |
+
def shape(self) -> tuple[int, int]:
|
| 26 |
+
return tuple(self.aligned["elevation_m"].shape)
|
| 27 |
+
|
| 28 |
+
def field(self, name: str, rows=slice(None), cols=slice(None)) -> np.ndarray:
|
| 29 |
+
return self.aligned[name][rows, cols]
|
| 30 |
+
|
| 31 |
+
def conditioning(self, rows=slice(None), cols=slice(None)) -> np.ndarray:
|
| 32 |
+
elevation = self.field("elevation_m", rows, cols).astype(np.float32)
|
| 33 |
+
temperature = self.field("temperature_mean_c", rows, cols).astype(np.float32)
|
| 34 |
+
seasonality = self.field("temperature_seasonality_c", rows, cols).astype(np.float32) * 100.0
|
| 35 |
+
precipitation = self.field("precipitation_mm_year", rows, cols).astype(np.float32)
|
| 36 |
+
precipitation_cv = self.field("precipitation_cv_percent", rows, cols).astype(np.float32)
|
| 37 |
+
elevation_signed_sqrt = np.sign(elevation) * np.sqrt(np.abs(elevation))
|
| 38 |
+
return np.stack([
|
| 39 |
+
elevation_signed_sqrt,
|
| 40 |
+
temperature,
|
| 41 |
+
seasonality,
|
| 42 |
+
precipitation,
|
| 43 |
+
precipitation_cv,
|
| 44 |
+
], axis=0)
|
| 45 |
+
|
| 46 |
+
def world_xy_to_pixel(self, x_km: float, y_km: float) -> tuple[int, int]:
|
| 47 |
+
height, width = self.shape
|
| 48 |
+
col = int(np.floor((x_km % float(self.h5.attrs["canvas_width_km"])) / float(self.h5.attrs["pixel_km_x"]))) % width
|
| 49 |
+
row = int(np.clip(np.floor(y_km / float(self.h5.attrs["pixel_km_y"])), 0, height - 1))
|
| 50 |
+
return row, col
|
| 51 |
+
|
| 52 |
+
def patch(self, center_x_km: float, center_y_km: float, width_cells: int, height_cells: int) -> dict[str, np.ndarray]:
|
| 53 |
+
height, width = self.shape
|
| 54 |
+
center_row, center_col = self.world_xy_to_pixel(center_x_km, center_y_km)
|
| 55 |
+
rows = np.clip(np.arange(center_row - height_cells // 2, center_row - height_cells // 2 + height_cells), 0, height - 1)
|
| 56 |
+
cols = np.arange(center_col - width_cells // 2, center_col - width_cells // 2 + width_cells) % width
|
| 57 |
+
result = {}
|
| 58 |
+
row_start = int(rows.min())
|
| 59 |
+
row_end = int(rows.max()) + 1
|
| 60 |
+
local_rows = rows - row_start
|
| 61 |
+
for name in self.aligned:
|
| 62 |
+
strip = self.aligned[name][row_start:row_end, :]
|
| 63 |
+
result[name] = strip[local_rows][:, cols]
|
| 64 |
+
return result
|
earth_data_processed_pack.tar.zst
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:746d91ec1d5c7ea1fdde0390bb7f8f4a016228c96f955b40ea445e4b0926417c
|
| 3 |
+
size 392015506
|
earth_structure_preview.png
ADDED
|
Git LFS Details
|
manifest.json
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "PASS",
|
| 3 |
+
"project_version": "1.0.0",
|
| 4 |
+
"width": 5184,
|
| 5 |
+
"height": 2592,
|
| 6 |
+
"projection": "flat_rectangular_equirectangular_canvas",
|
| 7 |
+
"full_hydro": true,
|
| 8 |
+
"pack": {
|
| 9 |
+
"path": "/content/earth_data_project_run/output/earth_data_pack.h5",
|
| 10 |
+
"bytes": 147202351,
|
| 11 |
+
"sha256": "b6737caad62b89a629cf246d8fa661805d713310ef439c318fb63dab070fbd50"
|
| 12 |
+
},
|
| 13 |
+
"remix_prior": {
|
| 14 |
+
"path": "/content/earth_data_project_run/output/earth_guided_remix_prior_seed_204149.npy",
|
| 15 |
+
"bytes": 268738688,
|
| 16 |
+
"sha256": "6dc77abbec695938aba5a4bfd69e716cc66057bc0bb87af11d0087b55b169be5",
|
| 17 |
+
"seed": 204149,
|
| 18 |
+
"earth_strength": 0.7
|
| 19 |
+
},
|
| 20 |
+
"outputs": [
|
| 21 |
+
"output/ATTRIBUTION.md",
|
| 22 |
+
"output/earth_climate_preview.png",
|
| 23 |
+
"output/earth_data_api.py",
|
| 24 |
+
"output/earth_data_pack.h5",
|
| 25 |
+
"output/earth_guided_remix_prior_seed_204149.npy",
|
| 26 |
+
"output/earth_structure_preview.png"
|
| 27 |
+
],
|
| 28 |
+
"source_downloads": {
|
| 29 |
+
"etopo2022_surface_60s": {
|
| 30 |
+
"url": "https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO2022/data/60s/60s_surface_elev_gtif/ETOPO_2022_v1_60s_N90W180_surface.tif",
|
| 31 |
+
"license": "CC0-1.0 / U.S. government public-domain dedication",
|
| 32 |
+
"citation": "NOAA National Centers for Environmental Information. 2022: ETOPO 2022 Global Relief Model. DOI 10.25921/fd45-gt74.",
|
| 33 |
+
"path": "/content/earth_data_project_run/downloads/etopo2022_surface_60s.tif",
|
| 34 |
+
"bytes": 465969062,
|
| 35 |
+
"sha256": "9d27d4b8ea8e76977e2988bca667d7c8fa68b927355feffcddd6b4875a7fd08e"
|
| 36 |
+
},
|
| 37 |
+
"natural_earth_land": {
|
| 38 |
+
"url": "https://naciscdn.org/naturalearth/10m/physical/ne_10m_land.zip",
|
| 39 |
+
"license": "Public domain",
|
| 40 |
+
"path": "/content/earth_data_project_run/downloads/natural_earth_land.zip",
|
| 41 |
+
"bytes": 3269070,
|
| 42 |
+
"sha256": "e547d749445eaa0964aba76738090ec88f5e63c4585122170f98c67a7ea922dc"
|
| 43 |
+
},
|
| 44 |
+
"natural_earth_coastline": {
|
| 45 |
+
"url": "https://naciscdn.org/naturalearth/10m/physical/ne_10m_coastline.zip",
|
| 46 |
+
"license": "Public domain",
|
| 47 |
+
"path": "/content/earth_data_project_run/downloads/natural_earth_coastline.zip",
|
| 48 |
+
"bytes": 3069451,
|
| 49 |
+
"sha256": "bfa04cdbcbef07ef90dfca1dabb48062eca29900a113df0f389303e255484017"
|
| 50 |
+
},
|
| 51 |
+
"natural_earth_lakes": {
|
| 52 |
+
"url": "https://naciscdn.org/naturalearth/10m/physical/ne_10m_lakes.zip",
|
| 53 |
+
"license": "Public domain",
|
| 54 |
+
"path": "/content/earth_data_project_run/downloads/natural_earth_lakes.zip",
|
| 55 |
+
"bytes": 2349685,
|
| 56 |
+
"sha256": "0803a06f9c3cb4671d89b68c48b142aad9366ba40f665245e12a913fbc61722a"
|
| 57 |
+
},
|
| 58 |
+
"natural_earth_rivers": {
|
| 59 |
+
"url": "https://naciscdn.org/naturalearth/10m/physical/ne_10m_rivers_lake_centerlines.zip",
|
| 60 |
+
"license": "Public domain",
|
| 61 |
+
"path": "/content/earth_data_project_run/downloads/natural_earth_rivers.zip",
|
| 62 |
+
"bytes": 2079507,
|
| 63 |
+
"sha256": "ded71b01870855ccfe19b51f2ec14c9bb48fae23c0e9f3c11974d426433b5c38"
|
| 64 |
+
},
|
| 65 |
+
"gplates_spreading_ridges": {
|
| 66 |
+
"url": "https://www.earthbyte.org/webdav/ftp/earthbyte/GPlates/SampleData_GPlates2.0/Individual/FeatureCollections/SpreadingRidges.zip",
|
| 67 |
+
"license": "CC-BY-3.0",
|
| 68 |
+
"path": "/content/earth_data_project_run/downloads/gplates_spreading_ridges.zip",
|
| 69 |
+
"bytes": 75592,
|
| 70 |
+
"sha256": "dc5b4845cf5fb8f117fbd3d63f9ea73522c5640214170f3a6948b771563a21a2"
|
| 71 |
+
},
|
| 72 |
+
"gplates_continent_ocean_boundaries": {
|
| 73 |
+
"url": "https://www.earthbyte.org/webdav/ftp/earthbyte/GPlates/SampleData_GPlates2.0/Individual/FeatureCollections/ContinentOceanBoundaries.zip",
|
| 74 |
+
"license": "CC-BY-3.0",
|
| 75 |
+
"path": "/content/earth_data_project_run/downloads/gplates_continent_ocean_boundaries.zip",
|
| 76 |
+
"bytes": 210435,
|
| 77 |
+
"sha256": "93fc731ba10d6465132e51d95db81f7c09daff1e86d04c97ca81ddd8329ad0ba"
|
| 78 |
+
},
|
| 79 |
+
"gplates_seafloor_fabric": {
|
| 80 |
+
"url": "https://www.earthbyte.org/webdav/ftp/earthbyte/GPlates/SampleData_GPlates2.0/Individual/FeatureCollections/SeafloorFabric.zip",
|
| 81 |
+
"license": "CC-BY-3.0",
|
| 82 |
+
"path": "/content/earth_data_project_run/downloads/gplates_seafloor_fabric.zip",
|
| 83 |
+
"bytes": 1224002,
|
| 84 |
+
"sha256": "7b47b4c03a53460c3ea264302e286c27ca8a0a0794f0d606711c4f1c5db73c11"
|
| 85 |
+
},
|
| 86 |
+
"gplates_static_polygons": {
|
| 87 |
+
"url": "https://www.earthbyte.org/webdav/ftp/earthbyte/GPlates/SampleData_GPlates2.0/Individual/FeatureCollections/StaticPolygons.zip",
|
| 88 |
+
"license": "CC-BY-3.0",
|
| 89 |
+
"path": "/content/earth_data_project_run/downloads/gplates_static_polygons.zip",
|
| 90 |
+
"bytes": 2505241,
|
| 91 |
+
"sha256": "256fd93f9804c4bef450ca2f629fcef380936fc19480bdf4620fa34410e2fe7b"
|
| 92 |
+
},
|
| 93 |
+
"ncep2_temperature": {
|
| 94 |
+
"url": "https://downloads.psl.noaa.gov/Datasets/ncep.reanalysis2/Monthlies/LTMs/gaussian_grid/air.2m.mon.ltm.1981-2010.nc",
|
| 95 |
+
"license": "NOAA public data; acknowledgment requested",
|
| 96 |
+
"path": "/content/earth_data_project_run/downloads/ncep2_temperature.nc",
|
| 97 |
+
"bytes": 537147,
|
| 98 |
+
"sha256": "5df58ab60f64018bc1670a6e86bb6861e5344cbe94e50bbf8db6e2e73f130581"
|
| 99 |
+
},
|
| 100 |
+
"ncep2_precipitation": {
|
| 101 |
+
"url": "https://downloads.psl.noaa.gov/Datasets/ncep.reanalysis2/Monthlies/LTMs/gaussian_grid/prate.sfc.mon.ltm.1981-2010.nc",
|
| 102 |
+
"license": "NOAA public data; acknowledgment requested",
|
| 103 |
+
"path": "/content/earth_data_project_run/downloads/ncep2_precipitation.nc",
|
| 104 |
+
"bytes": 717495,
|
| 105 |
+
"sha256": "6838641566ccee6d65fb047bbfd23f4b8eb8a83e7889aef472ce83d8649629ae"
|
| 106 |
+
},
|
| 107 |
+
"ncep2_u_wind": {
|
| 108 |
+
"url": "https://downloads.psl.noaa.gov/Datasets/ncep.reanalysis2/Monthlies/LTMs/gaussian_grid/uwnd.10m.mon.ltm.1981-2010.nc",
|
| 109 |
+
"license": "NOAA public data; acknowledgment requested",
|
| 110 |
+
"path": "/content/earth_data_project_run/downloads/ncep2_u_wind.nc",
|
| 111 |
+
"bytes": 731001,
|
| 112 |
+
"sha256": "8553ec6d53a65ed455c90ad6ded4367286d22d770dbc0a4972f9d9c098a84486"
|
| 113 |
+
},
|
| 114 |
+
"ncep2_v_wind": {
|
| 115 |
+
"url": "https://downloads.psl.noaa.gov/Datasets/ncep.reanalysis2/Monthlies/LTMs/gaussian_grid/vwnd.10m.mon.ltm.1981-2010.nc",
|
| 116 |
+
"license": "NOAA public data; acknowledgment requested",
|
| 117 |
+
"path": "/content/earth_data_project_run/downloads/ncep2_v_wind.nc",
|
| 118 |
+
"bytes": 746492,
|
| 119 |
+
"sha256": "06e881e0d81308d08b27e968e99915aaf4d591889f089a1fb7fcef5d3bb2ec23"
|
| 120 |
+
},
|
| 121 |
+
"hydrorivers_global": {
|
| 122 |
+
"url": "https://data.hydrosheds.org/file/HydroRIVERS/HydroRIVERS_v10_shp.zip",
|
| 123 |
+
"license": "HydroSHEDS license; attribution required; downloading indicates acceptance",
|
| 124 |
+
"path": "/content/earth_data_project_run/downloads/hydrorivers_global.zip",
|
| 125 |
+
"bytes": 544388154,
|
| 126 |
+
"sha256": "0cf9e363e4b48ede535787f9e2eecbcff43eb53acad4b9cbf048c9e12453e5b5"
|
| 127 |
+
},
|
| 128 |
+
"hydrolakes_global": {
|
| 129 |
+
"url": "https://data.hydrosheds.org/file/hydrolakes/HydroLAKES_polys_v10_shp.zip",
|
| 130 |
+
"license": "CC-BY-4.0",
|
| 131 |
+
"path": "/content/earth_data_project_run/downloads/hydrolakes_global.zip",
|
| 132 |
+
"bytes": 820295132,
|
| 133 |
+
"sha256": "9ef63498569dd7ccd0b8d8852da026e009a75f42d293f00e483f3b9fcfe8e1f9"
|
| 134 |
+
}
|
| 135 |
+
},
|
| 136 |
+
"archive": {
|
| 137 |
+
"path": "/content/earth_data_project_run/earth_data_processed_pack.tar.zst",
|
| 138 |
+
"bytes": 392015506,
|
| 139 |
+
"sha256": "746d91ec1d5c7ea1fdde0390bb7f8f4a016228c96f955b40ea445e4b0926417c"
|
| 140 |
+
}
|
| 141 |
+
}
|