Exemplo n.º 1
0
 def __init__(self):
     # Note: node spacing is constant in seconds, not months.
     # Months are not the same length in seconds so nodes
     # are not exactly place at month starts.
     
     self.n_triangulation_divisions=5
     self.alpha=2
     
     # Desired minimum model period
     start_time = datetime_to_decimal_year( datetime(1840, 1, 1) )
     end_time   = datetime_to_decimal_year( datetime(2025, 1, 1) )
     
     # Model time resolution in years
     node_spacing = 5.
     
     # Model start/end shifted to nearst grid times encompasing the desred start and end times
     self.starttime = floor_to_quantisation(start_time, node_spacing)
     self.endtime = ceil_to_quantisation(end_time, node_spacing)
     
     # number of model nodes in period
     self.n_nodes = int( round( (self.endtime - self.starttime) / node_spacing + 1 ) )
     
     self.overlap_factor=2.5
     self.H = 1
     self.amplitude=2.
     self.space_length_scale=25 #5.0  # length scale in units of degrees
     self.time_length_scale= 10   # length scale in units of years
Exemplo n.º 2
0
    def test_init(self):

        # Desired minimum model period
        start_time = datetime_to_decimal_year( datetime(1850, 1, 1) )
        end_time   = datetime_to_decimal_year( datetime(1860, 1, 1) )
        
        # Model time resolution is quarterly
        node_spacing = 0.25
        
        # Model start/end shifted to nearst grid times encompasing the desred start and end times
        model_start = floor_to_quantisation(start_time, node_spacing)
        model_end = ceil_to_quantisation(end_time, node_spacing)
        
        # number of model nodes in period
        n_nodes = int( round( (end_time - start_time) / node_spacing + 1 ) )
        
        element = AnnualKroneckerElement(n_triangulation_divisions=1, alpha=2, starttime=model_start, endtime=model_end, n_nodes=n_nodes, overlap_factor=2.5, H=1.0, wrap_dimensions = None)
        
        numpy.testing.assert_almost_equal( numpy.linspace(start_time, end_time, n_nodes).reshape(-1,1), element.temporal_model.lattice.nodes )
Exemplo n.º 3
0
    def __init__(self, observationstructure, spatial_model, alpha,
                 temporal_model, H):
        """Initialise space and time SPDE designs."""

        super(AnnualKroneckerDesign, self).__init__()

        self.spatial_model = spatial_model
        self.temporal_model = temporal_model

        self.alpha = alpha
        self.H = H

        self.spatial_locations = observationstructure.location_polar_coordinates(
        )

        decimal_year = datetime_to_decimal_year(
            observationstructure.time_datetime())
        self.temporal_locations = numpy.array([[decimal_year]])

        self.space_A = spatial_model.build_A(self.spatial_locations)
        self.time_A = temporal_model.build_A(self.temporal_locations)