Skip to content

Instantly share code, notes, and snippets.

@bekozi
Created March 14, 2018 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekozi/5ebd20bca06283040f820bf0830ba472 to your computer and use it in GitHub Desktop.
Save bekozi/5ebd20bca06283040f820bf0830ba472 to your computer and use it in GitHub Desktop.
import ocgis
from ocgis.test.base import create_gridxy_global, create_exact_field
# Path to the input ESRI Shapefile.
# PATH_SHP = '/home/benkoziol/l/data/bekozi-work/i53-jh-camel-watersheds/basin_set_full_res/HCDN_nhru_final_671.shp'
PATH_SHP = '/gcs/camels/basin_dataset_public_v1p2/shapefiles/merge/basinset_gf_nhru.shp'
# Path to example exact data for testing.
DATA_PATH = 'camels_source.nc'
# Create some source field test data.
grid = create_gridxy_global(crs=ocgis.crs.Spherical())
field = create_exact_field(grid, 'foo', ntime=3)
field.write(DATA_PATH)
# Spatially average each geometry and write the data to a time series file.
ops = ocgis.OcgOperations(dataset={'uri': DATA_PATH}, geom=PATH_SHP, aggregate=True, output_format='nc',
prefix='aggdata', add_auxiliary_files=False)
ops.execute()
@jhamman
Copy link

jhamman commented Mar 15, 2018

@bekozi - If I were to run this with mpirun, would the weights/aggregation steps be done in parallel (per geometry object)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment