Skip to content

Commit

Permalink
fixes for irregular grid handling of coordinate variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Hamman committed Apr 18, 2014
1 parent 84b6f07 commit 02334d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions rvic/core/read_forcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,13 @@ def __init__(self, path, file_str, time_fld, lat_fld, liq_flds,

# determine the latitude order
lats = f.variables[self.lat_fld][:]
if lats[-1] > lats[0]:
log.debug('Input fluxes came in upside down, flipping '
'params and maybe domain.')
self.lat0_is_min = True
if lats.ndim == 1:
if lats[-1] > lats[0]:
log.debug('Input fluxes came in upside down, flipping '
'params and maybe domain.')
self.lat0_is_min = True
else:
self.lat0_is_min = False
else:
self.lat0_is_min = False
else:
Expand Down
6 changes: 4 additions & 2 deletions rvic/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ def read_domain(domain_dict, lat0_is_min=False):
# Make sure the longitude / latitude vars are 2d
dom_lat = domain_dict['LATITUDE_VAR']
dom_lon = domain_dict['LONGITUDE_VAR']

dom_data['cord_lons'] = dom_data[dom_lon][:]
dom_data['cord_lats'] = dom_data[dom_lat][:]

if dom_data[dom_lon].ndim == 1:
dom_data['cord_lons'] = dom_data[dom_lon][:]
dom_data['cord_lats'] = dom_data[dom_lat][:]
# ------------------------------------------------------------- #
# Check latitude order, flip if necessary.
if (dom_data[dom_lat][-1] > dom_data[dom_lat][0]) != lat0_is_min:
Expand Down

0 comments on commit 02334d5

Please sign in to comment.