Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geopandas pyogrio driver test code #16

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions h5tests/geopandas_pyogrio_arr_mean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import subprocess

import h5py
import numpy as np
import pandas as pd

from .h5test import H5Test, timer_decorator

try:
os.environ["USE_PYGEOS"] = "0"
import geopandas as gpd
import pyogrio
except ImportError:
completed_process = subprocess.run(
["mamba", "install", "-c", "conda-forge", "pyogrio", "--yes"]
)
import pyogrio


class GeopandasPyogrioArrMean(H5Test):
@timer_decorator
def run(self):
group = "/gt1l/heights" # not used
variable = "h_ph"
geodataframes = []
for file in self.files:
# file = "s3://nasa-cryo-scratch/h5cloud/flatgeobuf/ATL03_20230211164520_08111812_006_01.fgb"
# print(f"Loading {file} into geopandas via pyogrio")
gdf = gpd.read_file(filename=file, engine="pyogrio")
geodataframes.append(gdf[variable])
final_geodataframe: gpd.Series = pd.concat(objs=geodataframes, axis="index")
return np.mean(final_geodataframe)