Changeset 4451


Ignore:
Timestamp:
May 16, 2007, 12:09:53 PM (17 years ago)
Author:
duncan
Message:

changing asserts to warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/coordinate_transforms/geo_reference.py

    r4389 r4451  
    11"""
     2
    23"""
    34
     
    5253         changing.
    5354         """
    54 
     55        if zone is None:
     56            zone = DEFAULT_ZONE
    5557        self.false_easting = false_easting
    5658        self.false_northing = false_northing       
     
    118120        except:
    119121            pass
    120         assert (self.false_easting == DEFAULT_FALSE_EASTING)
    121         assert (self.false_northing == DEFAULT_FALSE_NORTHING)
    122 
    123         assert(self.datum == DEFAULT_DATUM)
    124         assert(self.projection == DEFAULT_PROJECTION)
    125         assert (self.units == DEFAULT_UNITS)
     122        if (self.false_easting != DEFAULT_FALSE_EASTING):
     123            print "WARNING: False easting of %f specified." %self.false_easting
     124            print "Default false easting is %f." %DEFAULT_FALSE_EASTING
     125            print "ANUGA does not correct for differences in False Eastings."
     126           
     127        if (self.false_northing != DEFAULT_FALSE_NORTHING):
     128            print "WARNING: False northing of %f specified." \
     129                  %self.false_northing
     130            print "Default false northing is %f." %DEFAULT_FALSE_NORTHING
     131            print "ANUGA does not correct for differences in False Northings."
     132           
     133        if (self.datum.upper() != DEFAULT_DATUM.upper()):
     134            print "WARNING: Datum of %s specified." \
     135                  %self.datum
     136            print "Default Datum is %s." %DEFAULT_DATUM
     137            print "ANUGA does not correct for differences in datums."
     138           
     139        if (self.projection.upper() != DEFAULT_PROJECTION.upper()):
     140            print "WARNING: Projection of %s specified." \
     141                  %self.projection
     142            print "Default Projection is %s." %DEFAULT_PROJECTION
     143            print "ANUGA does not correct for differences in Projection."
     144           
     145        if (self.units.upper() != DEFAULT_UNITS.upper()):
     146            print "WARNING: Units of %s specified." \
     147                  %self.units
     148            print "Default units is %s." %DEFAULT_UNITS
     149            print "ANUGA does not correct for differences in units."
    126150       
    127151       
     
    301325    outfile is the name of the file to be written to.
    302326    """
     327    geo_ref = ensure_geo_reference(origin)
     328    geo_ref.write_NetCDF(outfile)
     329    return geo_ref
     330
     331def ensure_geo_reference(origin):
     332    """
     333    Given a list/tuple of zone, xllcorner and yllcorner of a geo-ref object,
     334    return a geo ref object.
     335
     336    If the origin is None, return None, so calling this function doesn't
     337    effect code logic
     338    """
    303339    if isinstance(origin, Geo_reference):
    304340        geo_ref = origin
     341    elif origin is None:
     342        geo_ref = None
    305343    else:
    306         geo_ref = apply(Geo_reference,origin)
    307     geo_ref.write_NetCDF(outfile)
     344        geo_ref = apply(Geo_reference,origin)       
    308345    return geo_ref
     346
    309347   
    310348#-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.