Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

conftest.py 3.7 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  1. from pathlib import Path
  2. import pytest
  3. import xarray as xr
  4. @pytest.fixture
  5. def geotiff_file(tmp_path: Path) -> str:
  6. """Create a NetCDF4 file with air temperature data."""
  7. filepath = tmp_path / "air.tif"
  8. with xr.tutorial.open_dataset("air_temperature") as ds:
  9. ds.isel(time=0).rio.to_raster(filepath, driver="COG", COMPRESS="DEFLATE")
  10. return str(filepath)
  11. def download_files():
  12. import pandas as pd
  13. import pooch
  14. current_file_path = Path(__file__).resolve()
  15. repo_root = current_file_path.parent.parent
  16. # download files from gdal autotest (https://github.com/OSGeo/gdal/tree/master/autotest) using list in https://gist.githubusercontent.com/mdsumner/29b22ece80c829ae4aefbecbf4eef531/raw/a8ea6f13f8c96b8434b7fc3ae0629814914135c0/autotest_tif.txt
  17. pooch.retrieve(
  18. "https://gist.githubusercontent.com/mdsumner/29b22ece80c829ae4aefbecbf4eef531/raw/a8ea6f13f8c96b8434b7fc3ae0629814914135c0/autotest_tif.txt",
  19. None,
  20. path=f"{repo_root}/tests/data",
  21. fname="gdal_autotest_files.txt",
  22. )
  23. df = pd.read_csv(
  24. f"{repo_root}/tests/data/gdal_autotest_files.txt", header=None, names=["file"]
  25. )
  26. outpath = f"{repo_root}/tests/data/gdal_autotest"
  27. for row in df.iterrows():
  28. file = f"https://raw.githubusercontent.com/OSGeo/gdal/refs/heads/master/autotest/{row[1].file}"
  29. outname = file.split("/")[-1]
  30. pooch.retrieve(file, known_hash=None, path=outpath, fname=outname)
  31. # download files from https://github.com/zarr-developers/VirtualiZarr/issues/526#issuecomment-2773597088 and https://github.com/zarr-developers/VirtualiZarr/issues/526#issuecomment-2773732236 and https://github.com/zarr-developers/VirtualiZarr/issues/526#issuecomment-2777745891
  32. files = [
  33. (
  34. "https://gitlab.com/Richard.Scott1/raster-analysis-goals/-/raw/main/test_reference.tif?ref_type=heads&inline=false",
  35. "ae9918a73b06e9246b081b01883acd10904a408edf6962b0198e399d5a6f2e09",
  36. ),
  37. (
  38. "https://data.eodc.eu/collections/SENTINEL1_SIG0_20M/V1M1R2/EQUI7_SA020M/E048N063T3/SIG0_20250404T234439__VH_A091_E048N063T3_SA020M_V1M1R2_S1AIWGRDH_TUWIEN.tif",
  39. "1bf8722f0a9e0897091c0ffc55c60ba1ef57d82865924666963b73d2c388614b",
  40. ),
  41. (
  42. "https://github.com/mdsumner/rema-ovr/raw/refs/heads/main/rema_mosaic_1km_v2.0_filled_cop30_dem.tif",
  43. "84227a0ead3140a62cce9c7310c76ff39a68a62c576972dab759312b663214bd",
  44. ),
  45. (
  46. "https://e84-earth-search-sentinel-data.s3.us-west-2.amazonaws.com/sentinel-2-c1-l2a/55/G/EN/2025/3/S2C_T55GEN_20250324T000834_L2A/TCI.tif",
  47. "92a2641890b3fa91a9623aee1f188c5b6604f50974cdee36defbfd8fd40e189d",
  48. ),
  49. (
  50. "https://data.source.coop/ausantarctic/ghrsst-mur-v2/2025/03/31/20250331090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1_analysed_sst.tif",
  51. "3878419f2bebd4a5b3b91d090976f3d64cc6ce55fb54f80688d6473719c65d24",
  52. ),
  53. (
  54. "https://github.com/mdsumner/ibcso-cog/raw/main/IBCSO_v2_ice-surface_cog.tif",
  55. "47d035bbb246ef5188abafbba089f8a3dcff807de5b84ddfeb22d18e6d536826",
  56. ),
  57. ]
  58. outpath = f"{repo_root}/tests/data"
  59. for f in files:
  60. file = f[0]
  61. outname = file.split("/")[-1].split("?")[0]
  62. pooch.retrieve(file, known_hash=None, path=outpath, fname=outname)
  63. # download 4 GB file from https://github.com/zarr-developers/VirtualiZarr/issues/526#issuecomment-2773732236
  64. pooch.retrieve(
  65. "https://projects.pawsey.org.au/idea-gebco-tif/GEBCO_2024.tif",
  66. "9992b941b3f1e2ecd39b4d79b96abd1b06c65a070d38c065312e4f3e80026cc3",
  67. path=f"{outpath}/xlarge_files/",
  68. fname="GEBCO_2024.tif",
  69. )
  70. if __name__ == "__main__":
  71. download_files()
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...