Skip to content

Commit

Permalink
Carry over units to vector based VirtualLayers
Browse files Browse the repository at this point in the history
Former-commit-id: 3ee75f6
  • Loading branch information
kwilcox committed Jul 17, 2015
1 parent 6eb5653 commit 15d2afd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wms/models/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ def make_vector_layer(cls, us, vs, std_name, style, dataset_id):
v_match = '_'.join([ x for x in v.standard_name.split('_') if x not in ['y', 'northward']])

if u_match == v_match:
if hasattr(u, 'units'):
units = u.units
elif hasattr(v, 'units'):
units = v.units
else:
units = None
try:
vl = VirtualLayer.objects.create(var_name='{},{}'.format(u._name, v._name),
std_name=std_name,
units=units,
description="U ({}) and V ({}) vectors".format(u._name, v._name),
dataset_id=dataset_id,
active=True)
Expand Down

0 comments on commit 15d2afd

Please sign in to comment.