Example #1
0
class CurrentCycleMoverSchema(GridCurrentMoverSchema):
    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)
Example #2
0
    def deserialize(cls, json_):
        """
        append correct schema for tide object
        """
        schema = cls._schema()

        if 'tide' in json_:
            schema.add(TideSchema())

        return schema.deserialize(json_)
Example #3
0
    def deserialize(cls, json_):
        """
        append correct schema for wind object
        """
        if not cls.is_sparse(json_):
            schema = cls._schema()

            if 'tide' in json_:
                schema.add(TideSchema())

            return schema.deserialize(json_)
        else:
            return json_
Example #4
0
    def serialize(self, json_='webapi'):
        """
        Since 'tide' property is saved as a reference when used in save file
        and 'save' option, need to add appropriate node to
        CurrentCycleMover schema
        """
        toserial = self.to_serialize(json_)
        schema = self.__class__._schema()

        if json_ == 'webapi' and 'tide' in toserial:
            schema.add(TideSchema(name='tide'))

        return schema.serialize(toserial)
Example #5
0
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)
Example #6
0
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)