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

Subsetting for schout #1

Open
water-e opened this issue Oct 22, 2021 · 1 comment
Open

Subsetting for schout #1

water-e opened this issue Oct 22, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@water-e
Copy link
Contributor

water-e commented Oct 22, 2021

  • schimpy version: new feature
  • Python version: 3x7

Description

This is a request for a new feature to allow subsetting (and transformation?) of output.

Requirements

Non-functional

  • Avoid new spatial dependencies (try to work with gdal/shapely/geopandas)
  • Prefer xarray for handling the files, not raw netcdf4
  • The subsetting capability can go into schimpy which we will start to use to hold only general interest stuff. The Bay-Delta specific driver script used for Suisun will go in BayDeltaSCHISM/scripts, which at least for now is the holder of Bay-Delta specific visualization recipes and scripts for things like X2, Suisun Habitat.

Functional

def create_partition(mesh,polygons,enforce_exact=False):
“”” Takes a mesh and list of polygons and partitions according to where the centroids (mesh.centroids in schimpy) fall. 
Parameters
------------
mesh : schimpy.SchismMesh The mesh to partition
    
polygons :  Polygons (parsed from shape file or yaml into SCHIMPY

enforce_exact: bool
Requires a unique, complete partition. Initially not implemented for True

Produces meshes and dicitonary(?) maps of local_to_global and global_to_local. (tuple or class)”””

def write_global_local_maps(dest,global_local,local_global):
"""writes maps out in the schism + visit format. Note that the global owner 
of a shared node is the lowest rank that contains it."""

Parameters:
------------
destdir : str 
Location to write

global_local: list
mapping from global node number (zero-based) to the partition ("proc" in real schism) and local index for nodes, elements, sides

local_global: list
list of mappings from each processor to the global counterpart

def partition_schout(infile, partitions, combined=True,exclude=[], 
                                 transform={“salt_depth_ave”: (depth_ave,”salt”)):
“”” Partitions a schout binary output file (start with combined) into a set of smaller schout files corresponding to each partition. 

Initially implementation will be nodal variables but ultimately native centered (edge centered velocity, prism centered tracers). 
Transform is an opportunity to generate new variables that are well determined with the data from one time step, but not based on time-stenciled operations. Exclude would be an opportunity to prune variables not desired by dropping variables, 
although certain variables that are required for well-formedness (zcor, wet-dry) and visualization would not be “excludable” so exclude = “all_data” could be used to exclude all but the non-excludable. No output, but side effect is production of files. p0000/schout_1.nc.  

@kjnam
Copy link
Member

kjnam commented Jun 16, 2023

This will be probably implemented in suxarray.

@kjnam kjnam added the enhancement New feature or request label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants