11import math
2+ from datetime import datetime , timedelta
23
34import numpy as np
45import pandas as pd
@@ -35,6 +36,7 @@ def _stommel_gyre_delaunay():
3536 method = "regional_delaunay" ,
3637 boundary_points = boundary_points ,
3738 )
39+ uxgrid .attrs ["Conventions" ] = "UGRID-1.0"
3840
3941 # Define arrays U (zonal), V (meridional) and P (sea surface height)
4042 U = np .zeros ((1 , 1 , lat .size ), dtype = np .float64 )
@@ -106,6 +108,8 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
106108 zc = 0.5 * (zf [:- 1 ] + zf [1 :]) # Vertical element centers
107109 nz = zf .size
108110 nz1 = zc .size
111+ num_days = 5
112+ date_array = [datetime (2000 , 1 , 1 ) + timedelta (days = i ) for i in range (num_days )]
109113
110114 # mask any point on one of the boundaries
111115 mask = (
@@ -119,26 +123,29 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
119123 method = "regional_delaunay" ,
120124 boundary_points = boundary_points ,
121125 )
126+ uxgrid .attrs ["Conventions" ] = "UGRID-1.0"
122127
123128 # Define arrays U (zonal), V (meridional) and P (sea surface height)
124129 U = np .ones (
125- (1 , nz1 , uxgrid .n_face ), dtype = np .float64
130+ (num_days , nz1 , uxgrid .n_face ), dtype = np .float64
126131 ) # Lateral velocity is on the element centers and face centers
127132 V = np .ones (
128- (1 , nz1 , uxgrid .n_face ), dtype = np .float64
133+ (num_days , nz1 , uxgrid .n_face ), dtype = np .float64
129134 ) # Lateral velocity is on the element centers and face centers
130135 W = np .zeros (
131- (1 , nz , uxgrid .n_node ), dtype = np .float64
136+ (num_days , nz , uxgrid .n_node ), dtype = np .float64
132137 ) # Vertical velocity is on the element faces and face vertices
133- P = np .ones ((1 , nz1 , uxgrid .n_node ), dtype = np .float64 ) # Pressure is on the element centers and face vertices
138+ P = np .ones (
139+ (num_days , nz1 , uxgrid .n_node ), dtype = np .float64
140+ ) # Pressure is on the element centers and face vertices
134141
135142 u = ux .UxDataArray (
136143 data = U ,
137144 name = "U" ,
138145 uxgrid = uxgrid ,
139146 dims = ["time" , "nz1" , "n_face" ],
140147 coords = dict (
141- time = (["time" ], pd . to_datetime ([ "2000-01-01" ]) ),
148+ time = (["time" ], date_array ),
142149 nz1 = (["nz1" ], zc ),
143150 ),
144151 attrs = dict (
@@ -151,7 +158,7 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
151158 uxgrid = uxgrid ,
152159 dims = ["time" , "nz1" , "n_face" ],
153160 coords = dict (
154- time = (["time" ], pd . to_datetime ([ "2000-01-01" ]) ),
161+ time = (["time" ], date_array ),
155162 nz1 = (["nz1" ], zc ),
156163 ),
157164 attrs = dict (
@@ -164,7 +171,7 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
164171 uxgrid = uxgrid ,
165172 dims = ["time" , "nz" , "n_node" ],
166173 coords = dict (
167- time = (["time" ], pd . to_datetime ([ "2000-01-01" ]) ),
174+ time = (["time" ], date_array ),
168175 nz1 = (["nz" ], zf ),
169176 ),
170177 attrs = dict (
@@ -177,7 +184,7 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
177184 uxgrid = uxgrid ,
178185 dims = ["time" , "nz1" , "n_node" ],
179186 coords = dict (
180- time = (["time" ], pd . to_datetime ([ "2000-01-01" ]) ),
187+ time = (["time" ], date_array ),
181188 nz1 = (["nz1" ], zc ),
182189 ),
183190 attrs = dict (description = "pressure" , units = "N/m^2" , location = "node" , mesh = "delaunay" , Conventions = "UGRID-1.0" ),
0 commit comments