class GridCurrentMoverSchema(CurrentMoversBaseSchema): filename = FilenameSchema( missing=drop, save=True, update=False, isdatafile=True, test_equal=False ) topology_file = FilenameSchema( missing=drop, save=True, update=False, isdatafile=True, test_equal=False ) current_scale = SchemaNode( Float(), missing=drop, save=True, update=True ) uncertain_along = SchemaNode( Float(), missing=drop, save=True, update=True ) uncertain_cross = SchemaNode( Float(), missing=drop, save=True, update=True ) extrapolate = SchemaNode( Bool(), missing=drop, save=True, update=True ) time_offset = SchemaNode( Float(), missing=drop, save=True, update=True ) is_data_on_cells = SchemaNode( Bool(), missing=drop, read_only=True ) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class IceWindMoverSchema(WindMoversBaseSchema): filename = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False) topology_file = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False)
class IceMoverSchema(CurrentMoversBaseSchema): filename = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False, update=False) topology_file = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False, update=False) current_scale = SchemaNode(Float(), missing=drop, save=True, update=True) uncertain_along = SchemaNode(Float(), missing=drop, save=True, update=True) uncertain_cross = SchemaNode(Float(), missing=drop, save=True, update=True) extrapolate = SchemaNode(Bool(), missing=drop, save=True, update=True)
class VariableSchemaBase(base_schema.ObjTypeSchema): #filename #data? units = SchemaNode(String()) time = TimeSchema(save_reference=True) grid = GridSchema(save_reference=True) data_file = FilenameSchema(isdatafile=True, test_equal=False, update=False) grid_file = FilenameSchema(isdatafile=True, test_equal=False, update=False) extrapolation_is_allowed = SchemaNode(Boolean()) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class PyCurrentMoverSchema(ObjTypeSchema): current = GeneralGnomeObjectSchema( acceptable_schemas=[VectorVariableSchema, GridCurrent._schema], save=True, update=True, save_reference=True) filename = FilenameSchema(missing=drop, save=True, update=False, isdatafile=True) current_scale = SchemaNode(Float(), missing=drop, save=True, update=True) extrapolation_is_allowed = SchemaNode(Bool(), missing=drop, save=True, update=True) # time_offset = SchemaNode( # Float(), missing=drop, save=True, update=True # ) on = SchemaNode(Bool(), missing=drop, save=True, update=True) active_start = SchemaNode(LocalDateTime(), missing=drop, validator=convertible_to_seconds, save=True, update=True) active_stop = SchemaNode(LocalDateTime(), missing=drop, validator=convertible_to_seconds, save=True, update=True) data_start = SchemaNode(LocalDateTime(), validator=convertible_to_seconds, read_only=True) data_stop = SchemaNode(LocalDateTime(), validator=convertible_to_seconds, read_only=True)
class GridWindMoverSchema(WindMoversBaseSchema): """ Similar to WindMover except it doesn't have wind_id """ filename = FilenameSchema(missing=drop, save=True, update=True, isdatafile=True, test_equal=False) topology_file = FilenameSchema(missing=drop, save=True, update=True, isdatafile=True, test_equal=False) wind_scale = SchemaNode(Float(), missing=drop, save=True, update=True) extrapolate = SchemaNode(Bool(), missing=drop, save=True, update=True)
class ShapeSchema(BaseOutputterSchema): filename = FilenameSchema( missing=drop, save=True, update=True, test_equal=False ) zip_output = SchemaNode( Boolean(), missing=drop, save=True, update=True )
class DemoObjSchema(base_schema.ObjTypeSchema): filename = FilenameSchema( save=True, update=True, isdatafile=True, test_equal=False, ) foo_float = colander.SchemaNode(colander.Float(), save=True, update=True) foo_float_array = colander.SequenceSchema(colander.SchemaNode( colander.Float()), read_only=True) timeseries = colander.SequenceSchema(colander.TupleSchema(children=[ colander.SchemaNode(colander.DateTime(default_tzinfo=None)), colander.SchemaNode(colander.Float()) ]), read_only=True) variable = base_schema.GeneralGnomeObjectSchema( acceptable_schemas=[TimeseriesDataSchema, TimeseriesVectorSchema], save=True, update=True, save_reference=True, ) variables = colander.SequenceSchema(base_schema.GeneralGnomeObjectSchema( acceptable_schemas=[TimeseriesDataSchema, TimeseriesVectorSchema]), save=True, update=True, save_reference=True)
class WindSchema(base_schema.ObjTypeSchema): ''' validate data after deserialize, before it is given back to pyGnome's from_dict to set _state of object ''' name = SchemaNode(String(), test_equal=False) description = SchemaNode(String()) filename = FilenameSchema(isdatafile=True, update=False, test_equal=False) #Thanks to CyTimeseries updated_at = SchemaNode(LocalDateTime()) latitude = SchemaNode(Float()) longitude = SchemaNode(Float()) source_id = SchemaNode(String()) source_type = SchemaNode(String(), validator=OneOf(wind_datasources._attr), default='undefined', missing='undefined') units = SchemaNode(String(), default='m/s') speed_uncertainty_scale = SchemaNode(Float()) timeseries = WindTimeSeriesSchema( test_equal=False ) #Because comparing datetimevalue2d arrays does not play nice extrapolation_is_allowed = SchemaNode(Boolean()) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class CurrentCycleMoverSchema(CurrentMoversBaseSchema): filename = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False, update=False) topology_file = FilenameSchema(missing=drop, save=True, isdatafile=True, test_equal=False, update=False) current_scale = SchemaNode(Float(), default=1, missing=drop, save=True, update=True) uncertain_duration = SchemaNode(Float(), default=24, missing=drop, save=True, update=True) uncertain_time_delay = SchemaNode(Float(), default=0, missing=drop, save=True, update=True) uncertain_along = SchemaNode(Float(), default=.5, missing=drop, save=True, update=True) uncertain_cross = SchemaNode(Float(), default=.25, missing=drop, save=True, update=True) tide = TideSchema(missing=drop, save=True, update=True, save_reference=True) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class KMZSchema(BaseOutputterSchema): ''' Nothing is required for initialization ''' # round_data = SchemaNode(Bool(), missing=drop) # round_to = SchemaNode(Int(), missing=drop) filename = FilenameSchema(missing=drop, save=True, update=True, test_equal=False)
class TimeSchema(base_schema.ObjTypeSchema): filename = FilenameSchema( isdatafile=True, test_equal=False, update=False ) varname = SchemaNode( String(), read_only=True ) data = SequenceSchema( SchemaNode( DateTime(default_tzinfo=None) ) )
class RendererSchema(BaseOutputterSchema): # not sure if bounding box needs defintion separate from LongLatBounds viewport = base_schema.LongLatBounds(save=True, update=True) # following are only used when creating objects, not updating - # so missing=drop map_filename = FilenameSchema(save=True, update=True, isdatafile=True, test_equal=False, missing=drop,) projection = ProjectionSchema(save=True, update=True, missing=drop) image_size = base_schema.ImageSize(save=True, update=False, missing=drop) output_dir = SchemaNode(String(), save=True, update=True, test_equal=False) draw_ontop = SchemaNode(String(), save=True, update=True)
class TideSchema(base_schema.ObjTypeSchema): 'Tide object schema' filename = FilenameSchema( save=True, update=False, isdatafile=True, test_equal=False ) scale_factor = SchemaNode( Float(), missing=drop, save=True, update=True ) extrapolation_is_allowed = SchemaNode(Boolean(), missing=drop, read_only=True) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class NetCDFOutputSchema(BaseOutputterSchema): 'colander schema for serialize/deserialize object' netcdf_filename = FilenameSchema( missing=drop, save=True, update=False, test_equal=False ) which_data = SchemaNode( String(), default='standard', missing=drop, save=True, update=True ) compress = SchemaNode( Bool(), missing=drop, save=True, update=True ) _start_idx = SchemaNode( Int(), missing=drop, save=True, read_only=True, test_equal=False ) _middle_of_run = SchemaNode( Bool(), missing=drop, save=True, read_only=True, test_equal=False )
class CatsMoverSchema(CurrentMoversBaseSchema): '''static schema for CatsMover''' filename = FilenameSchema(save=True, isdatafile=True, test_equal=False, update=False) scale = SchemaNode(Bool(), missing=drop, save=True, update=True) scale_refpoint = WorldPoint(missing=drop, save=True, update=True) scale_value = SchemaNode(Float(), missing=drop, save=True, update=True) # the following six could be shared with grid_current # in a currents base class down_cur_uncertain = SchemaNode(Float(), missing=drop, save=True, update=True) up_cur_uncertain = SchemaNode(Float(), missing=drop, save=True, update=True) right_cur_uncertain = SchemaNode(Float(), missing=drop, save=True, update=True) left_cur_uncertain = SchemaNode(Float(), missing=drop, save=True, update=True) uncertain_eddy_diffusion = SchemaNode(Float(), missing=drop, save=True, update=True) uncertain_eddy_v0 = SchemaNode(Float(), missing=drop, save=True, update=True) tide = TideSchema(missing=drop, save=True, update=True, save_reference=True) data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class PyCurrentMoverSchema(ObjTypeSchema): current = GeneralGnomeObjectSchema( save=True, update=True, save_reference=True, acceptable_schemas=[VectorVariableSchema, GridCurrent._schema]) filename = FilenameSchema(save=True, update=False, isdatafile=True, missing=drop) scale_value = SchemaNode(Float(), save=True, update=True, missing=drop) on = SchemaNode(Bool(), missing=drop, save=True, update=True) active_range = TimeRangeSchema() data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class PyWindMoverSchema(ObjTypeSchema): wind = GeneralGnomeObjectSchema( save=True, update=True, save_reference=True, acceptable_schemas=[VectorVariableSchema, GridWind._schema]) filename = FilenameSchema(save=True, update=False, isdatafile=True, missing=drop) wind_scale = SchemaNode(Float(), save=True, update=True, missing=drop) extrapolation_is_allowed = SchemaNode(Bool(), save=True, update=True, missing=drop) time_offset = SchemaNode(Float(), save=True, update=True, missing=drop) on = SchemaNode(Bool(), save=True, update=True, missing=drop) active_range = TimeRangeSchema() data_start = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds) data_stop = SchemaNode(LocalDateTime(), read_only=True, validator=convertible_to_seconds)
class DepthSchema(base_schema.ObjTypeSchema): filename = FilenameSchema(isdatafile=True, test_equal=False, update=False)
class GridSchema(base_schema.ObjTypeSchema): name = SchemaNode( String(), test_equal=False) #remove this once gridded stops using _def_count filename = FilenameSchema(isdatafile=True, test_equal=False, update=False)