TIME_GRID

CLASS

class slcode.grid.TIME_GRID(time_step=array([1, 2]), maxdeg=64, height_time_grid=None, mass_time_grid=None, mass_time_coeff=None, height_time_coeff=None, rho=0, grid_name='time_grid', from_file=(False,), superinit=False)

The TIME_GRID class is used to manage the mass grids. These grids have a time dimenssion this way wa can manage the time variation of the mass. We can define the mass grid by it’s mass directly or by coupling a height with a density. If needed you can load spherical harmonics coefficient.Tis class is inheriting the methods from sphericalobject and GRID.

Attributes

time_stepnp.array([time_step_number,])

This array contains the time step of the data you are importing. They will be use for temporal interpolation.

maxdegint

Maximum harmonic coefficient degree of the data. this define the chape of the grid and coefficient arrays

height_time_gridnp.array([maxedg*2,maxdeg])

This array is the height grid at each time steps defined in grid_time_step

mass_time_gridnp.array([maxedg*2,maxdeg])

This array is the mass grid at each time steps defined in grid_time_step

height_time_coeffnp.array([(maxdeg+1)(maxedg+2)/2,])

This array is the height spherical harmonic coefficient at each time steps defined in grid_time_step

mass_time_coeffnp.array([(maxdeg+1)(maxedg+2)/2,])

This array is the mass spherical harmonic coefficient at each time steps defined in grid_time_step

rhofloat

The density of the considered layer.

Note

In future development the density may vary threw space and time. We’ll have to make a variable object more then a constant density.

grid_namestr

The name of the grid. We recommand you to choose a specific name for each grid you create. This name is used to save the grid in an nc file with save.

from_file(bool,way)

This parameter define if the data are new or loaded from a previously saved model in a nc file. If the first element is False, the code will create a blank object, based on provided datas. If the first element is True, the method will get the data from the file way specified in the second element of this attribute.

superinitbool

This parameter is used to specify if the object is used as herited method in an initialisation of a child class object.

Methods

interp_on_time

Interpolate a grid over the time considered in the model

interp_on_time_and_space :

Interpolate the grid over time and space as in the defined Grid during the initialisation of the class

grid_from_step :

Get the grid for a defined time iteration

coeff_from_step :

Get the spherical harmonics coefficient for a defined time iteration

timegrdtotimecoeff :

Convert the grid into spherical harmonics coefficient for all time steps

timecoefftotimegrd :

Convert the spherical harmonics coefficient into grid for all time steps

zeros_time :

Generate a zero grid for all time steps

disk_time :

Generate a disk of a specified thickness at a specified location over all time steps

update_0 :

Update the 0 time step data of the grid

save :

Save the grid in a specified nc file with the name of the grid

Note

This class is under active developement and not usable right now

Methods

slcode.grid.TIME_GRID.interp_on_time(self, grid_to_interp, grid_time_step, model_time_step, interp_type='Thickness_divide', backend='False', grid_type='regular')

The function interp_on_time is used for interpolation upon time and space it call the interpolation function of the GRID parameter. This function adapt the order of time and space interpolation to reduce computation time. The temporal interpolation try to preserve the thickness of the overall time. Tis is down by cutting and merging time steps of the original grid to match the model time_step.

Attributes

grid_to_interpnp.array([k,n,m])

The grid to be interpreted.

grid_time_stepnp.array([k,])

The time value of each time step of the grid model.

model_time_step ; np.array([time_step_number,])

The time values of the model.

interp_typestr

No use of this parameter anymore

backendbool

Define if the function retur, backends. True it will return the backends, False (default value) don’t give any backend.

Return :

grid_interpolatednp.array([time_step_number,n,m])

The interpolated grid over time. Depending of the model parameters.


slcode.grid.TIME_GRID.interp_on_time_and_space(self, grid_to_interp, grid_time_step, grid_lon, grid_lat, interp_type='Thickness_divide', backend=False, grid_type='global')

The interp_on_time_and_space function is used for interpolation upon time and space it call the interpolation function of the GRID parameter. This function perform the temporal and spatial interpolation in different order to ameliorate the computation time. If the temporal resolution of the input grid is higher than the model time resolution the temporal resolution will be perform first. The spatial resolution is performed first in the other case.

Attributes

grid_to_interpnp.array([k,n,m])

The grid to be interpreted.

grid_time_stepnp.array([k,])

The time value of each time step of the grid_to_interp.

grid_lonnp.array([n])

The longitudinal coordinates of the grid_to_interp.

grid_latnp.array([m])

The latitudinal coordinate of the grid_to_interp.

interp_typestr

No use of this parameter anymore

backendbool

Define if the function retur, backends. True it will return the backends, False (default value) don’t give any backend.

Return :

grid_interpolatednp.array([time_step_number,maxdeg*2,maxdeg])

The interpolated grid over time. Depending of the model parameters.


slcode.grid.TIME_GRID.grid_from_step(self, t_it)

The grid_from_step method is used to get the value of the grid at the defined time step.

Attributes :

t_itint

This is the value of the time step iteration on wich you are trying to retreave the grid. It must inside the time_step interpolation you have used during the initialisation of the time grid.

Return :

None


slcode.grid.TIME_GRID.coeff_from_step(self, t_it)

The coeff_from_step method is used to get the value of the coefficient at the requested time iteration.

Attributes :

t_itdouble

This is the value of the time step iteration on wich you are trying to retreave the coefficient. It must be inside the time_step interpolation you have used during the initialisation of the time grid.

Return :

None


slcode.grid.TIME_GRID.timegrdtotimecoeff(self)

The timegrdtotimecoeff method transform for each time step the grid into spherical harmonics coefficient.

Attribute :

None

Result :

None


slcode.grid.TIME_GRID.timecoefftotimegrd(self)

The timecoefftotimegrd method transform for each time step the spherical harmonic coefficient into a grid.

Attribute :

None

Result :

None


slcode.grid.TIME_GRID.zeros_time(self, time_step_number)

The zeros_time method is used to define a grid over time with only 0 value. It is based on GRID.zeros.

Attribute :

time_step_numberint

The number of time step on wich we apply the zeros grid.

Return :

None


slcode.grid.TIME_GRID.disk_time(self, time_step_number, lat, lon, radius, high)

The disk_time method is used to define a grid over time with a disk defined with it’s center coordinate and the height. This function is based on GRID.disk.

Attribute :

time_step_numberint

The number of time step on wich the disk load will be applyed.

latdouble

The latitude of the center of the disk (°).

londouble

The longitude of the center of the disk (°).

radiusdouble

The radius of the disk (°).

highdouble

The high of the disk (m).

Return :

None


slcode.grid.TIME_GRID.update_0(self)

The update_0 function is used to save the first time iteration of the object before it’s modification to be called at any moment in the code without alteration.

Attribute :

None

Return :

None


slcode.grid.TIME_GRID.save(self, save_way='', supersave=False)

The save function is used to save the grid and all it’s parameters inside a nc file. Parameters saved are, longitude, latitude, maximum degree, the time steps of the grid, the thickness of the grid, the harmonic coefficient, grid density. The harmonic coefficient, due to complexe data type management of nc, are saved separately in there complexe and real part. The created file will have the name of the grid.

Attribute :

save_waystr

The filepath where the data will be saved. Default value is the current file

supersavebool

Define if the save is called as a super method from an object that inherit the function. This precise if this method has to close the nc file (False) of if the herited class will do it (True). Default value is False.

Return :

None