From c18d16874295cdbbe4f3e9a76ba67c03807605e0 Mon Sep 17 00:00:00 2001 From: michaelchin Date: Thu, 14 Sep 2023 22:10:47 +1000 Subject: [PATCH] use pmm to get raster --- test-with-plate-model-manager/conftest.py | 31 ++++++++++------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/test-with-plate-model-manager/conftest.py b/test-with-plate-model-manager/conftest.py index e66bf093..4dafd95d 100644 --- a/test-with-plate-model-manager/conftest.py +++ b/test-with-plate-model-manager/conftest.py @@ -1,13 +1,17 @@ -import pytest -import gplately +import gzip +import os +import shutil + import numpy as np -import os, gzip, shutil -import tempfile -import matplotlib.pyplot as plt -import cartopy.crs as ccrs -from gplately import DataCollection -from plate_model_manager import PlateModelManager, network_requests import pygplates +import pytest +from plate_model_manager import ( + PlateModelManager, + PresentDayRasterManager, + network_requests, +) + +import gplately ## ========================== @@ -148,15 +152,8 @@ def gplately_raster_object( def gplately_merdith_raster( gplately_merdith_reconstruction, ): - if not os.path.isfile("ETOPO1_Ice_g_gmt4/ETOPO1_Ice_g_gmt4.grd"): - network_requests.fetch_large_file( - "https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/netcdf/ETOPO1_Ice_g_gmt4.grd.gz", - "ETOPO1_Ice_g_gmt4", - ) - with open("ETOPO1_Ice_g_gmt4/ETOPO1_Ice_g_gmt4.grd", "w+b") as output: - with gzip.open("ETOPO1_Ice_g_gmt4/ETOPO1_Ice_g_gmt4.grd.gz") as zipped: - shutil.copyfileobj(zipped, output) - etopo = gplately.Raster(data="ETOPO1_Ice_g_gmt4/ETOPO1_Ice_g_gmt4.grd") + raster_manager = PresentDayRasterManager() + etopo = gplately.Raster(data=raster_manager.get_raster("ETOPO1_grd")) etopo = etopo.data.astype("float") downsampled = etopo[::15, ::15] raster = gplately.Raster(