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

Tile fix #8

Merged
merged 28 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dccc741
got rid of incorrect removal of "overlap points"
fraserwg Sep 11, 2020
692022f
updated test script to use new CL options
fraserwg Sep 11, 2020
6fb7f2d
updated format of command line options passed to calc_pv_of_tile
fraserwg Sep 11, 2020
983a893
refactored docstring comment enclosure
fraserwg Sep 11, 2020
06c4aeb
refactored docstrings
fraserwg Sep 11, 2020
944b63e
refactored open_tile calling arguments
fraserwg Sep 11, 2020
8c83f11
removed getopt import
fraserwg Sep 11, 2020
1538399
minor refactor of calc_pv_of_tile
fraserwg Sep 11, 2020
57dc36e
added functions converting bi and bj to tile numbers and vice versa
fraserwg Sep 14, 2020
75e2b22
refactored key checking in _drain_the_component_que
fraserwg Sep 14, 2020
db7ba40
do not care about db/dz edge order
fraserwg Sep 14, 2020
14ca553
Merge pull request #7 from fraserwg/tile_fix_2
fraserwg Sep 14, 2020
76b0528
Merge branch 'tile_fix' of github.com:fraserwg/PVCALC into tile_fix
fraserwg Sep 14, 2020
bbee819
started adding overlaps to grad_b function
fraserwg Sep 14, 2020
f77428a
working tiling of density gradients
fraserwg Sep 14, 2020
17407d2
refactored rhoref to use xr.DataArray increasing robustness
fraserwg Sep 14, 2020
bc92e42
fixed density tiling
fraserwg Sep 14, 2020
baa0279
started changing hor_vort to communicate between tiles
fraserwg Sep 14, 2020
7600e80
added a temporary development file
fraserwg Sep 14, 2020
7a58fac
removed tile argument from grad_b
fraserwg Sep 15, 2020
a6c4271
zonal tiling and tile coordinate conversion fixes
fraserwg Sep 15, 2020
ce109df
working vorticity tiling correction
fraserwg Sep 15, 2020
db22a00
added process based output streams
fraserwg Sep 15, 2020
94ae7d1
reduced number of processors in test script
fraserwg Sep 15, 2020
c0ea7e9
added rando file to .gitignore
fraserwg Sep 15, 2020
1d9aeae
updated function calls
fraserwg Sep 15, 2020
a26a712
updated changes
fraserwg Sep 15, 2020
9808ceb
incrememnted version number for new release
fraserwg Sep 15, 2020
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ PVCALC.egg-info
*.ipynb_checkpoints
*.nc
RhoRef.*
*.out
*.out
test/test_data/.nfs00000000004800f200000009
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
v0.2.0
- Fixes to level modules and scripts which remove tile edges from calculations
- Some changes to test scripts
- Bug fixes
20 changes: 10 additions & 10 deletions PVCALC/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import xarray as xr

def construct_grid_file_name(processor, tile):
''' Gives the relative path to a grid file name
""" Gives the relative path to a grid file name

Arguments:
processor --> the mnc folder name (string). e.g. 'mnc_0001'
Expand All @@ -16,28 +16,28 @@ def construct_grid_file_name(processor, tile):
Returns:
fn --> The relative path to the grid netcdf file of the tile (sting).
There is no guarantee that such a file exists however!
'''
"""
fn = processor + '/grid.' + tile + '.nc'
return fn


def deconstruct_processor_tile_relation(fn):
''' Gives the processor and tile names from a grid file name
""" Gives the processor and tile names from a grid file name

Arguments:
fn --> string of the form './mnc_XXXX/VAR.tYYYY.*nc'

Returns:
processor --> string of the processor folder name, e.g. 'mnc_0001'
tile --> string of the tile name, e.g. 't0001'
'''
"""
processor = fn.split('/')[0]
tile = fn.split('.')[1]
return processor, tile


def is_boundary(da_depth):
''' Determines is a tile is a boundary tile
""" Determines is a tile is a boundary tile

Arguments:
da_depth --> xarray.dataarray object. Contains depth values for
Expand All @@ -54,7 +54,7 @@ def is_boundary(da_depth):
lines of lattitude or longitude. If the depth is zero at points
adjacent to the corners of the domain the edge is deemed to be a
boundary.
'''
"""
North, South, East, West = False, False, False, False
if not da_depth.isel({'X': 1, 'Y': -1}).data:
North = True
Expand All @@ -68,7 +68,7 @@ def is_boundary(da_depth):


def calc_q(ds_b, da_vvort, ds_hvort):
''' Calculates the PV by combining arrays of its constituents
""" Calculates the PV by combining arrays of its constituents

Arguments:
ds_b --> xarray dataset containing buoyancy gradients. Must contain
Expand All @@ -85,7 +85,7 @@ def calc_q(ds_b, da_vvort, ds_hvort):

Notes:
All inputs must be given on the same grid.
'''
"""
vert = da_vvort * ds_b['dbdz']
merid = ds_hvort['merid'] * ds_b['dbdy']
zonal = ds_hvort['zonal'] * ds_b['dbdx']
Expand All @@ -95,7 +95,7 @@ def calc_q(ds_b, da_vvort, ds_hvort):


def format_vertical_coordinates(ds, ds_grid):
''' adds meaningful labels and depths to a dataset output by MITgcm diags
""" adds meaningful labels and depths to a dataset output by MITgcm diags

Arguments:
ds --> dataset that needs the verical coordinates formatting
Expand All @@ -105,7 +105,7 @@ def format_vertical_coordinates(ds, ds_grid):
Returns:
ds --> dataset with meainingful vertical coordinate labels and names
applied
'''
"""
Zmd_name = 'Zmd{:06d}'.format(ds.Nr)
Zld_name = 'Zld{:06d}'.format(ds.Nr)
Zud_name = 'Zud{:06d}'.format(ds.Nr)
Expand Down
Loading