\n",
" \n",
" \n",
@@ -471,17 +471,17 @@
" \n",
" Bytes | \n",
" 2.53 kiB | \n",
- " 2.53 kiB | \n",
+ " 800 B | \n",
" \n",
" \n",
" \n",
" Shape | \n",
" (324,) | \n",
- " (324,) | \n",
+ " (100,) | \n",
" \n",
" \n",
" Dask graph | \n",
- " 1 chunks in 9 graph layers | \n",
+ " 4 chunks in 9 graph layers | \n",
" \n",
" \n",
" Data type | \n",
@@ -499,6 +499,9 @@
"\n",
" \n",
" \n",
+ " \n",
+ " \n",
+ " \n",
" \n",
"\n",
" \n",
@@ -510,7 +513,7 @@
"\n",
" \n",
" \n",
- " average_T1 (time) datetime64[ns] dask.array<chunksize=(324,), meta=np.ndarray> - long_name :
- Start time for average period
- cell_methods :
- time: mean
average_T1 (time) datetime64[ns] dask.array<chunksize=(100,), meta=np.ndarray> - long_name :
- Start time for average period
- cell_methods :
- time: mean
\n",
" \n",
" \n",
" \n",
@@ -526,17 +529,17 @@
" \n",
" Bytes | \n",
" 2.53 kiB | \n",
- " 2.53 kiB | \n",
+ " 800 B | \n",
" \n",
" \n",
" \n",
" Shape | \n",
" (324,) | \n",
- " (324,) | \n",
+ " (100,) | \n",
" \n",
" \n",
" Dask graph | \n",
- " 1 chunks in 9 graph layers | \n",
+ " 4 chunks in 9 graph layers | \n",
" \n",
" \n",
" Data type | \n",
@@ -554,6 +557,9 @@
"\n",
" \n",
" \n",
+ " \n",
+ " \n",
+ " \n",
" \n",
"\n",
" \n",
@@ -565,7 +571,7 @@
"\n",
" \n",
" \n",
- " average_T2 (time) datetime64[ns] dask.array<chunksize=(324,), meta=np.ndarray> - long_name :
- End time for average period
- cell_methods :
- time: mean
average_T2 (time) datetime64[ns] dask.array<chunksize=(100,), meta=np.ndarray> - long_name :
- End time for average period
- cell_methods :
- time: mean
\n",
" \n",
" \n",
" \n",
@@ -581,17 +587,17 @@
" \n",
" Bytes | \n",
" 2.53 kiB | \n",
- " 2.53 kiB | \n",
+ " 800 B | \n",
" \n",
" \n",
" \n",
" Shape | \n",
" (324,) | \n",
- " (324,) | \n",
+ " (100,) | \n",
" \n",
" \n",
" Dask graph | \n",
- " 1 chunks in 9 graph layers | \n",
+ " 4 chunks in 9 graph layers | \n",
" \n",
" \n",
" Data type | \n",
@@ -609,6 +615,9 @@
"\n",
" \n",
" \n",
+ " \n",
+ " \n",
+ " \n",
" \n",
"\n",
" \n",
@@ -620,7 +629,7 @@
"\n",
" \n",
" \n",
- " ssh (time, yh, xh) float32 dask.array<chunksize=(22, 225, 206), meta=np.ndarray> - units :
- m
- long_name :
- Sea Surface Height
- cell_methods :
- area:mean yh:mean xh:mean time: mean
- cell_measures :
- area: areacello
- time_avg_info :
- average_T1,average_T2,average_DT
ssh (time, yh, xh) float32 dask.array<chunksize=(100, 225, 206), meta=np.ndarray> - units :
- m
- long_name :
- Sea Surface Height
- cell_methods :
- area:mean yh:mean xh:mean time: mean
- cell_measures :
- area: areacello
- time_avg_info :
- average_T1,average_T2,average_DT
\n",
" \n",
" \n",
" \n",
@@ -636,17 +645,17 @@
" \n",
" Bytes | \n",
" 809.40 MiB | \n",
- " 3.89 MiB | \n",
+ " 17.68 MiB | \n",
" \n",
" \n",
" \n",
" Shape | \n",
" (324, 845, 775) | \n",
- " (22, 225, 206) | \n",
+ " (100, 225, 206) | \n",
" \n",
" \n",
" Dask graph | \n",
- " 240 chunks in 15 graph layers | \n",
+ " 64 chunks in 15 graph layers | \n",
" \n",
" \n",
" Data type | \n",
@@ -667,19 +676,8 @@
"\n",
" \n",
" \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
+ " \n",
" \n",
- " \n",
- " \n",
- " \n",
- " \n",
" \n",
" \n",
"\n",
@@ -688,19 +686,8 @@
"\n",
" \n",
" \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
- " \n",
+ " \n",
" \n",
- " \n",
- " \n",
- " \n",
- " \n",
" \n",
" \n",
"\n",
@@ -738,7 +725,7 @@
"\n",
" \n",
" \n",
- " time_bnds (time, nv) datetime64[ns] dask.array<chunksize=(324, 2), meta=np.ndarray> - long_name :
- time axis boundaries
- cell_methods :
- time: mean
time_bnds (time, nv) datetime64[ns] dask.array<chunksize=(100, 2), meta=np.ndarray> - long_name :
- time axis boundaries
- cell_methods :
- time: mean
\n",
" \n",
" \n",
" \n",
@@ -754,17 +741,17 @@
" \n",
" Bytes | \n",
" 5.06 kiB | \n",
- " 5.06 kiB | \n",
+ " 1.56 kiB | \n",
" \n",
" \n",
" \n",
" Shape | \n",
" (324, 2) | \n",
- " (324, 2) | \n",
+ " (100, 2) | \n",
" \n",
" \n",
" Dask graph | \n",
- " 1 chunks in 12 graph layers | \n",
+ " 4 chunks in 12 graph layers | \n",
" \n",
" \n",
" Data type | \n",
@@ -778,6 +765,9 @@
"\n",
" \n",
" \n",
+ " \n",
+ " \n",
+ " \n",
" \n",
"\n",
" \n",
@@ -793,7 +783,7 @@
"\n",
" \n",
" \n",
- " | PandasIndex PandasIndex(Index([ -98.0, -97.92001342773438, -97.83999633789062,\n",
" -97.760009765625, -97.67999267578125, -97.60000610351562,\n",
" -97.51998901367188, -97.44000244140625, -97.3599853515625,\n",
" -97.27999877929688,\n",
@@ -802,7 +792,7 @@
" -36.55999755859375, -36.480010986328125, -36.399993896484375,\n",
" -36.32000732421875, -36.239990234375, -36.160003662109375,\n",
" -36.079986572265625],\n",
- " dtype='float64', name='xh', length=775)) PandasIndex PandasIndex(Index([ 5.272542476654053, 5.352199077606201, 5.431845188140869,\n",
+ " dtype='float64', name='xh', length=775)) PandasIndex PandasIndex(Index([ 5.272542476654053, 5.352199077606201, 5.431845188140869,\n",
" 5.511480331420898, 5.5911054611206055, 5.670719146728516,\n",
" 5.750322341918945, 5.829914093017578, 5.909494400024414,\n",
" 5.989063739776611,\n",
@@ -811,7 +801,7 @@
" 51.82025146484375, 51.839073181152344, 51.857879638671875,\n",
" 51.876670837402344, 51.895450592041016, 51.914215087890625,\n",
" 51.93296432495117],\n",
- " dtype='float64', name='yh', length=845)) PandasIndex PandasIndex(DatetimeIndex(['1993-01-16 12:00:00', '1993-02-15 00:00:00',\n",
+ " dtype='float64', name='yh', length=845)) PandasIndex PandasIndex(DatetimeIndex(['1993-01-16 12:00:00', '1993-02-15 00:00:00',\n",
" '1993-03-16 12:00:00', '1993-04-16 00:00:00',\n",
" '1993-05-16 12:00:00', '1993-06-16 00:00:00',\n",
" '1993-07-16 12:00:00', '1993-08-16 12:00:00',\n",
@@ -822,7 +812,7 @@
" '2019-07-16 12:00:00', '2019-08-16 12:00:00',\n",
" '2019-09-16 00:00:00', '2019-10-16 12:00:00',\n",
" '2019-11-16 00:00:00', '2019-12-16 12:00:00'],\n",
- " dtype='datetime64[ns]', name='time', length=324, freq=None)) PandasIndex PandasIndex(Index([ -98.04000854492188, -97.95999145507812, -97.8800048828125,\n",
+ " dtype='datetime64[ns]', name='time', length=324, freq=None)) PandasIndex PandasIndex(Index([ -98.04000854492188, -97.95999145507812, -97.8800048828125,\n",
" -97.79998779296875, -97.72000122070312, -97.6400146484375,\n",
" -97.55999755859375, -97.48001098632812, -97.39999389648438,\n",
" -97.32000732421875,\n",
@@ -831,7 +821,7 @@
" -36.519989013671875, -36.44000244140625, -36.3599853515625,\n",
" -36.279998779296875, -36.20001220703125, -36.1199951171875,\n",
" -36.040008544921875],\n",
- " dtype='float64', name='xq', length=776)) PandasIndex PandasIndex(Index([5.2327094078063965, 5.312370777130127, 5.392022132873535,\n",
+ " dtype='float64', name='xq', length=776)) PandasIndex PandasIndex(Index([5.2327094078063965, 5.312370777130127, 5.392022132873535,\n",
" 5.471662521362305, 5.551292896270752, 5.6309123039245605,\n",
" 5.7105207443237305, 5.790118217468262, 5.869704246520996,\n",
" 5.949278831481934,\n",
@@ -840,7 +830,7 @@
" 51.82966232299805, 51.84847640991211, 51.867279052734375,\n",
" 51.88606262207031, 51.90483474731445, 51.92359161376953,\n",
" 51.94233322143555],\n",
- " dtype='float64', name='yq', length=846)) PandasIndex PandasIndex(Index([1.0, 2.0], dtype='float64', name='nv'))
- NumFilesInSet :
- 1
- title :
- NWA12_MOM6_v1.0
- grid_type :
- regular
- grid_tile :
- N/A
"
+ " dtype='float64', name='yq', length=846))PandasIndex PandasIndex(Index([1.0, 2.0], dtype='float64', name='nv')) - NumFilesInSet :
- 1
- title :
- NWA12_MOM6_v1.0
- grid_type :
- regular
- grid_tile :
- N/A
"
],
"text/plain": [
" Size: 914MB\n",
@@ -868,11 +858,11 @@
" wet_c (yq, xq) float32 3MB ...\n",
" ... ...\n",
" areacello_bu (yq, xq) float32 3MB ...\n",
- " average_DT (time) timedelta64[ns] 3kB dask.array\n",
- " average_T1 (time) datetime64[ns] 3kB dask.array\n",
- " average_T2 (time) datetime64[ns] 3kB dask.array\n",
- " ssh (time, yh, xh) float32 849MB dask.array\n",
- " time_bnds (time, nv) datetime64[ns] 5kB dask.array\n",
+ " average_DT (time) timedelta64[ns] 3kB dask.array\n",
+ " average_T1 (time) datetime64[ns] 3kB dask.array\n",
+ " average_T2 (time) datetime64[ns] 3kB dask.array\n",
+ " ssh (time, yh, xh) float32 849MB dask.array\n",
+ " time_bnds (time, nv) datetime64[ns] 5kB dask.array\n",
"Attributes:\n",
" NumFilesInSet: 1\n",
" title: NWA12_MOM6_v1.0\n",
@@ -880,7 +870,7 @@
" grid_tile: N/A"
]
},
- "execution_count": 3,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -891,7 +881,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 5,
"id": "cf89b0a6",
"metadata": {},
"outputs": [],
@@ -902,17 +892,17 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"id": "4598e1d0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
@@ -942,17 +932,17 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 7,
"id": "6713ee3b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 6,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
@@ -998,7 +988,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"id": "d20f46a1",
"metadata": {},
"outputs": [],
@@ -1010,7 +1000,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"id": "d43d9e2b",
"metadata": {},
"outputs": [
@@ -1021,7 +1011,7 @@
" 299., 300., 301., 302., 303., 304., 305., 306., 307., 308.])"
]
},
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -1032,7 +1022,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"id": "a2ee27aa",
"metadata": {},
"outputs": [
@@ -1047,7 +1037,7 @@
" 41.5, 41.6, 41.7, 41.8, 41.9])"
]
},
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -1058,7 +1048,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 11,
"id": "770fe22e",
"metadata": {},
"outputs": [],
@@ -1074,7 +1064,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 12,
"id": "bf67401d",
"metadata": {},
"outputs": [
@@ -1450,21 +1440,21 @@
" * lon (lon) float64 168B 288.0 289.0 290.0 291.0 ... 306.0 307.0 308.0\n",
" * lat (lat) float64 480B 36.0 36.1 36.2 36.3 36.4 ... 41.6 41.7 41.8 41.9\n",
"Data variables:\n",
- " var (lon, lat) object 10kB None None None None ... None None None None"
],
"text/plain": [
" Size: 11kB\n",
@@ -1496,7 +1486,7 @@
" var (lon, lat) object 10kB None None None None ... None None None None"
]
},
- "execution_count": 11,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -1507,7 +1497,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 13,
"id": "ecd8065e",
"metadata": {},
"outputs": [],
@@ -1521,7 +1511,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 14,
"id": "73794ccc",
"metadata": {},
"outputs": [],
@@ -1548,17 +1538,17 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 15,
"id": "c4dadeb4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 14,
+ "execution_count": 15,
"metadata": {},
"output_type": "execute_result"
},
@@ -1579,17 +1569,17 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 16,
"id": "82d08c9c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 15,
+ "execution_count": 16,
"metadata": {},
"output_type": "execute_result"
},
@@ -1622,7 +1612,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 17,
"id": "9bbdae4a",
"metadata": {},
"outputs": [],
@@ -1632,17 +1622,17 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 18,
"id": "fdaba4ca",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 17,
+ "execution_count": 18,
"metadata": {},
"output_type": "execute_result"
},
@@ -1671,17 +1661,17 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 19,
"id": "2380503a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- ""
+ ""
]
},
- "execution_count": 18,
+ "execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
@@ -1713,17 +1703,17 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 20,
"id": "f2bcfd90",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "[]"
+ "[]"
]
},
- "execution_count": 19,
+ "execution_count": 20,
"metadata": {},
"output_type": "execute_result"
},
@@ -1746,17 +1736,17 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 21,
"id": "00cda0c1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "[]"
+ "[]"
]
},
- "execution_count": 20,
+ "execution_count": 21,
"metadata": {},
"output_type": "execute_result"
},
@@ -1794,7 +1784,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 22,
"id": "1cab593a",
"metadata": {},
"outputs": [],
@@ -1806,17 +1796,17 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 23,
"id": "56ad95e8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "[]"
+ "[]"
]
},
- "execution_count": 22,
+ "execution_count": 23,
"metadata": {},
"output_type": "execute_result"
},
@@ -1837,7 +1827,7 @@
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": 24,
"id": "79dd04b2",
"metadata": {},
"outputs": [
@@ -2210,7 +2200,7 @@
"<xarray.DataArray 'ssh' ()> Size: 4B\n",
"array(264.06818, dtype=float32)\n",
"Attributes:\n",
- " regrid_method: bilinear "
+ " regrid_method: bilinear"
],
"text/plain": [
" Size: 4B\n",
@@ -2219,7 +2209,7 @@
" regrid_method: bilinear"
]
},
- "execution_count": 26,
+ "execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
@@ -2230,7 +2220,7 @@
},
{
"cell_type": "code",
- "execution_count": 27,
+ "execution_count": 25,
"id": "13b6f335",
"metadata": {},
"outputs": [
@@ -2603,7 +2593,7 @@
"<xarray.DataArray 'ssh' ()> Size: 4B\n",
"array(2.5614245, dtype=float32)\n",
"Attributes:\n",
- " regrid_method: bilinear "
+ " regrid_method: bilinear"
],
"text/plain": [
" Size: 4B\n",
@@ -2612,7 +2602,7 @@
" regrid_method: bilinear"
]
},
- "execution_count": 27,
+ "execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@@ -2623,7 +2613,7 @@
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": 26,
"id": "63e151b6",
"metadata": {},
"outputs": [
@@ -2996,7 +2986,7 @@
"<xarray.DataArray 'ssh' ()> Size: 4B\n",
"array(-2.5407326, dtype=float32)\n",
"Attributes:\n",
- " regrid_method: bilinear "
+ " regrid_method: bilinear"
],
"text/plain": [
" Size: 4B\n",
@@ -3005,7 +2995,7 @@
" regrid_method: bilinear"
]
},
- "execution_count": 28,
+ "execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
@@ -3016,7 +3006,7 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 27,
"id": "42a9084a",
"metadata": {},
"outputs": [
@@ -3389,7 +3379,7 @@
"<xarray.DataArray 'ssh' ()> Size: 4B\n",
"array(2.3547514e-08, dtype=float32)\n",
"Attributes:\n",
- " regrid_method: bilinear "
+ " regrid_method: bilinear"
],
"text/plain": [
" Size: 4B\n",
@@ -3398,7 +3388,7 @@
" regrid_method: bilinear"
]
},
- "execution_count": 30,
+ "execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
@@ -3409,9 +3399,592 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 28,
"id": "0a67b15d",
"metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[0.40913385, 0.4205915 , 0.43135014, 0.44204688, 0.45230874,\n",
+ " 0.46195292, 0.47079858, 0.47871488, 0.48534378, 0.4908307 ],\n",
+ " [0.38955772, 0.40217236, 0.4140448 , 0.42513934, 0.43593633,\n",
+ " 0.4461491 , 0.45552126, 0.46386734, 0.4711971 , 0.47730386],\n",
+ " [0.36643493, 0.3803743 , 0.39363012, 0.4058602 , 0.41737258,\n",
+ " 0.42826962, 0.43834072, 0.44750646, 0.45569324, 0.46282324],\n",
+ " [0.34001982, 0.3552434 , 0.36969236, 0.38337183, 0.39619532,\n",
+ " 0.40812942, 0.4191765 , 0.42916495, 0.43827644, 0.446518 ],\n",
+ " [0.31142107, 0.32754627, 0.34310752, 0.35788384, 0.37197092,\n",
+ " 0.38531047, 0.3975977 , 0.40887263, 0.4190892 , 0.4283061 ],\n",
+ " [0.2801041 , 0.29733598, 0.3137071 , 0.32929528, 0.34460595,\n",
+ " 0.35903302, 0.37270442, 0.38526958, 0.39732766, 0.40761095],\n",
+ " [0.24636601, 0.26461577, 0.2822602 , 0.2988469 , 0.31450638,\n",
+ " 0.33041596, 0.34454936, 0.35826007, 0.3704158 , 0.3822541 ],\n",
+ " [0.20961332, 0.22938614, 0.24863204, 0.26698545, 0.28345364,\n",
+ " 0.29852995, 0.314388 , 0.32920575, 0.34285143, 0.35552308],\n",
+ " [0.16741553, 0.18968211, 0.21128514, 0.23151474, 0.25001755,\n",
+ " 0.26707643, 0.28304267, 0.29798904, 0.3129194 , 0.32786447],\n",
+ " [0.1196053 , 0.14411843, 0.16858232, 0.19165336, 0.21215399,\n",
+ " 0.23047513, 0.2506695 , 0.26762426, 0.28357905, 0.2986067 ]],\n",
+ " dtype=float32)"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ds.ssh.isel(time=0).where((ds.lon>x[0])&\n",
+ " (ds.lony[0])&\n",
+ " (ds.latx[0])&\n",
+ " (ds.lony[0])&\n",
+ " (ds.lat\n",
+ "<xarray.DataArray 'xh' (xh: 10)> Size: 80B\n",
+ "array([-71.920013, -71.839996, -71.76001 , -71.679993, -71.600006, -71.519989,\n",
+ " -71.440002, -71.359985, -71.279999, -71.200012])\n",
+ "Coordinates:\n",
+ " * xh (xh) float64 80B -71.92 -71.84 -71.76 ... -71.36 -71.28 -71.2\n",
+ " time datetime64[ns] 8B 1993-01-16T12:00:00 -71.92 -71.84 -71.76 -71.68 -71.6 -71.52 -71.44 -71.36 -71.28 -71.2 array([-71.920013, -71.839996, -71.76001 , -71.679993, -71.600006, -71.519989,\n",
+ " -71.440002, -71.359985, -71.279999, -71.200012]) PandasIndex PandasIndex(Index([-71.92001342773438, -71.83999633789062, -71.760009765625,\n",
+ " -71.67999267578125, -71.60000610351562, -71.51998901367188,\n",
+ " -71.44000244140625, -71.3599853515625, -71.27999877929688,\n",
+ " -71.20001220703125],\n",
+ " dtype='float64', name='xh'))
"
+ ],
+ "text/plain": [
+ " Size: 80B\n",
+ "array([-71.920013, -71.839996, -71.76001 , -71.679993, -71.600006, -71.519989,\n",
+ " -71.440002, -71.359985, -71.279999, -71.200012])\n",
+ "Coordinates:\n",
+ " * xh (xh) float64 80B -71.92 -71.84 -71.76 ... -71.36 -71.28 -71.2\n",
+ " time datetime64[ns] 8B 1993-01-16T12:00:00"
+ ]
+ },
+ "execution_count": 31,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ds_mock.xh"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "id": "b2a38b5d",
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "MissingDimensionsError",
+ "evalue": "cannot set variable 'lon' with 2-dimensional data without explicit dimension names. Pass a tuple of (dims, data) instead.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mMissingDimensionsError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[32], line 77\u001b[0m\n\u001b[1;32m 74\u001b[0m dims \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtime\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlat\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlon\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 76\u001b[0m \u001b[38;5;66;03m# Create the DataArray\u001b[39;00m\n\u001b[0;32m---> 77\u001b[0m da_mock \u001b[38;5;241m=\u001b[39m \u001b[43mxr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDataArray\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcoords\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcoords\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdims\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdims\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m ds_data \u001b[38;5;241m=\u001b[39m xr\u001b[38;5;241m.\u001b[39mDataset()\n\u001b[1;32m 79\u001b[0m ds_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mssh\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m da_mock\n",
+ "File \u001b[0;32m~/mambaforge/envs/regional_mom/lib/python3.11/site-packages/xarray/core/dataarray.py:454\u001b[0m, in \u001b[0;36mDataArray.__init__\u001b[0;34m(self, data, coords, dims, name, attrs, indexes, fastpath)\u001b[0m\n\u001b[1;32m 452\u001b[0m data \u001b[38;5;241m=\u001b[39m _check_data_shape(data, coords, dims)\n\u001b[1;32m 453\u001b[0m data \u001b[38;5;241m=\u001b[39m as_compatible_data(data)\n\u001b[0;32m--> 454\u001b[0m coords, dims \u001b[38;5;241m=\u001b[39m \u001b[43m_infer_coords_and_dims\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshape\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcoords\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdims\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 455\u001b[0m variable \u001b[38;5;241m=\u001b[39m Variable(dims, data, attrs, fastpath\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 457\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(coords, Coordinates):\n",
+ "File \u001b[0;32m~/mambaforge/envs/regional_mom/lib/python3.11/site-packages/xarray/core/dataarray.py:184\u001b[0m, in \u001b[0;36m_infer_coords_and_dims\u001b[0;34m(shape, coords, dims)\u001b[0m\n\u001b[1;32m 182\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m utils\u001b[38;5;241m.\u001b[39mis_dict_like(coords):\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m coords\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m--> 184\u001b[0m new_coords[k] \u001b[38;5;241m=\u001b[39m \u001b[43mas_variable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mv\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauto_convert\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 185\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m new_coords[k]\u001b[38;5;241m.\u001b[39mdims \u001b[38;5;241m==\u001b[39m (k,):\n\u001b[1;32m 186\u001b[0m new_coords[k] \u001b[38;5;241m=\u001b[39m new_coords[k]\u001b[38;5;241m.\u001b[39mto_index_variable()\n",
+ "File \u001b[0;32m~/mambaforge/envs/regional_mom/lib/python3.11/site-packages/xarray/core/variable.py:147\u001b[0m, in \u001b[0;36mas_variable\u001b[0;34m(obj, name, auto_convert)\u001b[0m\n\u001b[1;32m 145\u001b[0m data: T_DuckArray \u001b[38;5;241m=\u001b[39m as_compatible_data(obj)\n\u001b[1;32m 146\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m data\u001b[38;5;241m.\u001b[39mndim \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m--> 147\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m MissingDimensionsError(\n\u001b[1;32m 148\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcannot set variable \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mname\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m with \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdata\u001b[38;5;241m.\u001b[39mndim\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m-dimensional data \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 149\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwithout explicit dimension names. Pass a tuple of \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 150\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m(dims, data) instead.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 151\u001b[0m )\n\u001b[1;32m 152\u001b[0m obj \u001b[38;5;241m=\u001b[39m Variable(name, data, fastpath\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 153\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
+ "\u001b[0;31mMissingDimensionsError\u001b[0m: cannot set variable 'lon' with 2-dimensional data without explicit dimension names. Pass a tuple of (dims, data) instead."
+ ]
+ }
+ ],
+ "source": [
+ "data = [\n",
+ "[0.40913385, 0.4205915 , 0.43135014, 0.44204688, 0.45230874,\n",
+ " 0.46195292, 0.47079858, 0.47871488, 0.48534378, 0.4908307 ],\n",
+ "[0.38955772, 0.40217236, 0.4140448 , 0.42513934, 0.43593633,\n",
+ " 0.4461491 , 0.45552126, 0.46386734, 0.4711971 , 0.47730386],\n",
+ "[0.36643493, 0.3803743 , 0.39363012, 0.4058602 , 0.41737258,\n",
+ " 0.42826962, 0.43834072, 0.44750646, 0.45569324, 0.46282324],\n",
+ "[0.34001982, 0.3552434 , 0.36969236, 0.38337183, 0.39619532,\n",
+ " 0.40812942, 0.4191765 , 0.42916495, 0.43827644, 0.446518 ],\n",
+ "[0.31142107, 0.32754627, 0.34310752, 0.35788384, 0.37197092,\n",
+ " 0.38531047, 0.3975977 , 0.40887263, 0.4190892 , 0.4283061 ],\n",
+ "[0.2801041 , 0.29733598, 0.3137071 , 0.32929528, 0.34460595,\n",
+ " 0.35903302, 0.37270442, 0.38526958, 0.39732766, 0.40761095],\n",
+ "[0.24636601, 0.26461577, 0.2822602 , 0.2988469 , 0.31450638,\n",
+ " 0.33041596, 0.34454936, 0.35826007, 0.3704158 , 0.3822541 ],\n",
+ "[0.20961332, 0.22938614, 0.24863204, 0.26698545, 0.28345364,\n",
+ " 0.29852995, 0.314388 , 0.32920575, 0.34285143, 0.35552308],\n",
+ "[0.16741553, 0.18968211, 0.21128514, 0.23151474, 0.25001755,\n",
+ " 0.26707643, 0.28304267, 0.29798904, 0.3129194 , 0.32786447],\n",
+ "[0.1196053 , 0.14411843, 0.16858232, 0.19165336, 0.21215399,\n",
+ " 0.23047513, 0.2506695 , 0.26762426, 0.28357905, 0.2986067 ]\n",
+ "]\n",
+ "data = np.stack([data,data,data,data])\n",
+ "lon = [\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ],\n",
+ " [288.08, 288.16, 288.24, 288.32, 288.4 , 288.48, 288.56, 288.64,\n",
+ " 288.72, 288.8 ]\n",
+ "]\n",
+ "lat = [\n",
+ " [36.00555 , 36.00555 , 36.00555 , 36.00555 , 36.00555 , 36.00555 ,\n",
+ " 36.00555 , 36.00555 , 36.00555 , 36.00555 ],\n",
+ " [36.07024 , 36.07024 , 36.07024 , 36.07024 , 36.07024 , 36.07024 ,\n",
+ " 36.07024 , 36.07024 , 36.07024 , 36.07024 ],\n",
+ " [36.134876, 36.134876, 36.134876, 36.134876, 36.134876, 36.134876,\n",
+ " 36.134876, 36.134876, 36.134876, 36.134876],\n",
+ " [36.199463, 36.199463, 36.199463, 36.199463, 36.199463, 36.199463,\n",
+ " 36.199463, 36.199463, 36.199463, 36.199463],\n",
+ " [36.263992, 36.263992, 36.263992, 36.263992, 36.263992, 36.263992,\n",
+ " 36.263992, 36.263992, 36.263992, 36.263992],\n",
+ " [36.32847 , 36.32847 , 36.32847 , 36.32847 , 36.32847 , 36.32847 ,\n",
+ " 36.32847 , 36.32847 , 36.32847 , 36.32847 ],\n",
+ " [36.392895, 36.392895, 36.392895, 36.392895, 36.392895, 36.392895,\n",
+ " 36.392895, 36.392895, 36.392895, 36.392895],\n",
+ " [36.457264, 36.457264, 36.457264, 36.457264, 36.457264, 36.457264,\n",
+ " 36.457264, 36.457264, 36.457264, 36.457264],\n",
+ " [36.521584, 36.521584, 36.521584, 36.521584, 36.521584, 36.521584,\n",
+ " 36.521584, 36.521584, 36.521584, 36.521584],\n",
+ " [36.585846, 36.585846, 36.585846, 36.585846, 36.585846, 36.585846,\n",
+ " 36.585846, 36.585846, 36.585846, 36.585846]\n",
+ "]\n",
+ "time = xr.date_range(start='2000-01-01',periods=4,freq='MS')\n",
+ "\n",
+ "# Define some coordinates and dimensions\n",
+ "coords = {'time': time,\n",
+ " 'lon' : lon,\n",
+ " 'lat' : lat}\n",
+ "dims = ['time', 'lat', 'lon']\n",
+ "\n",
+ "# Create the DataArray\n",
+ "da_mock = xr.DataArray(data, coords=coords, dims=dims)\n",
+ "ds_data = xr.Dataset()\n",
+ "ds_data['ssh'] = da_mock"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "57bfc806",
+ "metadata": {},
"outputs": [],
"source": []
}
From 13063a64c753e18e48c14e73ca90127b334bd0e2 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:34:14 -0600
Subject: [PATCH 08/20] allow the pytest to have --options
---
tests/conftest.py | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 tests/conftest.py
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..8717db6
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,8 @@
+import pytest
+
+def pytest_addoption(parser):
+ parser.addoption("--location", action="store", default="opendap")
+
+@pytest.fixture
+def location(request):
+ return request.config.getoption("--location")
From 504b827cff250448ae33a7b597f08c59874ecfb5 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:34:58 -0600
Subject: [PATCH 09/20] unit testing the
gulf stream index
open historical dataset
the opendap solution
---
tests/test_mom6_indexes.py | 52 +++++++++++++++++++++++++++++---------
1 file changed, 40 insertions(+), 12 deletions(-)
diff --git a/tests/test_mom6_indexes.py b/tests/test_mom6_indexes.py
index 2415db6..8f4e01f 100644
--- a/tests/test_mom6_indexes.py
+++ b/tests/test_mom6_indexes.py
@@ -1,16 +1,44 @@
-import warnings
import numpy as np
from mom6.mom6_module import mom6_indexes
+from mom6.mom6_module import mom6_process
-warnings.simplefilter("ignore")
-def test_gulf_stream_index():
- GFI = mom6_indexes.GulfStreamIndex(
- data_type='historical',
- grid='raw')
- ds = GFI.generate_index()
-
- # print(np.abs(ds.gulf_stream_index).sum().compute().data)
- assert np.abs(np.abs(ds.gulf_stream_index).sum().compute().data - 264.06818) < 1e-5
- assert np.abs(ds.gulf_stream_index.max().compute().data - 2.5614245) < 1e-7
- assert np.abs(ds.gulf_stream_index.min().compute().data - -2.5407326) < 1e-7
+def test_gulf_stream_index(location:str='opendap'):
+ """testing the gulf stream index calculation
+
+ Parameters
+ ----------
+ location : str
+ The location of where the data is extracted.
+
+ Raises
+ ------
+ ValueError
+ The location input in string does not exist.
+ """
+ if location == 'local':
+ ds_test = mom6_process.MOM6Historical.get_mom6_all('ssh','raw',location)
+ ds_test = ds_test.rename({'geolon':'lon','geolat':'lat'})
+ elif location == 'opendap':
+ ds_test = mom6_process.MOM6Historical.get_mom6_all('ssh','raw',location)
+ ds_test = ds_test.isel(time=slice(0,24)).load()
+ ds_test = ds_test.rename({'geolon':'lon','geolat':'lat'})
+ else :
+ raise ValueError(
+ f'the input --location={location} '+
+ 'does not exist. Please put "local" or "opendap".'
+ )
+
+ mom_gfi = mom6_indexes.GulfStreamIndex(ds_test,'ssh')
+ ds_gs = mom_gfi.generate_index()
+
+ if location == 'local':
+ # whole dataset examination
+ assert np.abs(np.abs(ds_gs.gulf_stream_index).sum().compute().data - 264.06818) < 1e-5
+ assert np.abs(ds_gs.gulf_stream_index.max().compute().data - 2.5614245) < 1e-6
+ assert np.abs(ds_gs.gulf_stream_index.min().compute().data - -2.5407326) < 1e-6
+ elif location == 'opendap':
+ # only two years of data
+ assert np.abs(np.abs(ds_gs.gulf_stream_index).sum().compute().data - 20.642387) < 1e-5
+ assert np.abs(ds_gs.gulf_stream_index.max().compute().data - 1.7084963) < 1e-6
+ assert np.abs(ds_gs.gulf_stream_index.min().compute().data - -1.7084963) < 1e-6
From a5118437058cc9db794b02c8e3f5c928127c3262 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:37:57 -0600
Subject: [PATCH 10/20] change name
---
.github/workflows/gha_pytest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index 3515882..b7408fb 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -6,7 +6,7 @@ on:
- develop
jobs:
- checking_json:
+ unittest:
runs-on: ubuntu-latest
steps:
From 31fb8387ab77f60994f47c707965b19894ed67f1 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:40:11 -0600
Subject: [PATCH 11/20] try out the working yml
---
.github/workflows/gha_pytest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index b7408fb..303275d 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -13,7 +13,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- - name: Setup Micromamba
+ - name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
environment-file: regional_mom6.yml
From f7379562f24f40d31f8ad3dec2e5940c062bd578 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:41:53 -0600
Subject: [PATCH 12/20] yml name bug
---
.github/workflows/gha_pytest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index 303275d..29f2d60 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -16,7 +16,7 @@ jobs:
- name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
- environment-file: regional_mom6.yml
+ environment-file: regional_mom.yml
init-shell: bash
- name: pytesting
From 87f35affa20dabe520e4fd48e752abd27372c889 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:46:32 -0600
Subject: [PATCH 13/20] yml name error
---
region_mom.yml => regional_mom6.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
rename region_mom.yml => regional_mom6.yml (86%)
diff --git a/region_mom.yml b/regional_mom6.yml
similarity index 86%
rename from region_mom.yml
rename to regional_mom6.yml
index 878f256..093d8ff 100644
--- a/region_mom.yml
+++ b/regional_mom6.yml
@@ -1,6 +1,4 @@
-# regional_mom.yml
-
-name: regional_mom
+name: regional_mom6
channels:
- conda-forge
dependencies:
From 343306be57d64052613744c467822b1f5bab4884 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 13:46:56 -0600
Subject: [PATCH 14/20] error in yml name
---
.github/workflows/gha_pytest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index 29f2d60..303275d 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -16,7 +16,7 @@ jobs:
- name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
- environment-file: regional_mom.yml
+ environment-file: regional_mom6.yml
init-shell: bash
- name: pytesting
From 5986aa74433442d6f6da2a4f6c290fc3645cf073 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:13:21 -0600
Subject: [PATCH 15/20] minimizing the env file
---
regional_mom6.yml | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/regional_mom6.yml b/regional_mom6.yml
index 093d8ff..d3c4763 100644
--- a/regional_mom6.yml
+++ b/regional_mom6.yml
@@ -2,20 +2,10 @@ name: regional_mom6
channels:
- conda-forge
dependencies:
- - cartopy
- - cftime
- dask
- - gsw
- - jupyterlab
- - matplotlib
- - nc-time-axis
- netcdf4
- pydap
- - pylint
- - pyshp
- python=3.11
- - scipy
- - shapely
- xarray
- xesmf
- pytest
From 5839c86b6d1b275d6ccf9480aebe6d693b68fb69 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:16:56 -0600
Subject: [PATCH 16/20] update GHA to setup config file
---
.github/workflows/gha_pytest.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index 303275d..e6414e5 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -19,6 +19,10 @@ jobs:
environment-file: regional_mom6.yml
init-shell: bash
+ - name: Setup package config file
+ shell: bash -l {0}
+ run: cp config.json.template config.json
+
- name: pytesting
shell: bash -l {0}
run: pytest
\ No newline at end of file
From fc7d44587a40a8febda3d32303ca3ff297375f42 Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:24:04 -0600
Subject: [PATCH 17/20] testing yml file
---
.github/workflows/gha_pytest.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index e6414e5..d3c1c20 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -4,6 +4,7 @@ on:
pull_request:
branches:
- develop
+ - main
jobs:
unittest:
@@ -13,7 +14,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- - name: Setup Micromamba ${{ matrix.python-version }}
+ - name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: regional_mom6.yml
From f23c8bb3959b0268badb1a85d8405d439442c5ce Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:28:06 -0600
Subject: [PATCH 18/20] include testing after push
---
.github/workflows/gha_pytest.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest.yml
index d3c1c20..65102ef 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest.yml
@@ -1,6 +1,10 @@
name: PR pytest checking
on:
+ push:
+ branches:
+ - develop
+ - main
pull_request:
branches:
- develop
From cc6b0dd23a7e488d6b97cc618d18097b67865c0a Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:30:32 -0600
Subject: [PATCH 19/20] include badget for push test
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 3f6fbb9..d6223c3 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![unittest](https://github.com/NOAA-PSL/regional_mom6/actions/workflows/gha_pytest_push.yml/badge.svg)](https://github.com/NOAA-PSL/regional_mom6/actions/workflows/gha_pytest_push.yml)
+
NOAA Climate, Ecosystems, and Fisheries Initiative (CEFI) - Data Portal Team
========
From 0662122370f589fd4b75a71ee2ab6a578447a6ea Mon Sep 17 00:00:00 2001
From: "C.-W. HSU" <11950284+chiaweh2@users.noreply.github.com>
Date: Wed, 17 Apr 2024 14:30:44 -0600
Subject: [PATCH 20/20] seperate push and pr test
---
.../{gha_pytest.yml => gha_pytest_pr.yml} | 8 ++---
.github/workflows/gha_pytest_push.yml | 29 +++++++++++++++++++
2 files changed, 31 insertions(+), 6 deletions(-)
rename .github/workflows/{gha_pytest.yml => gha_pytest_pr.yml} (86%)
create mode 100644 .github/workflows/gha_pytest_push.yml
diff --git a/.github/workflows/gha_pytest.yml b/.github/workflows/gha_pytest_pr.yml
similarity index 86%
rename from .github/workflows/gha_pytest.yml
rename to .github/workflows/gha_pytest_pr.yml
index 65102ef..67177f6 100644
--- a/.github/workflows/gha_pytest.yml
+++ b/.github/workflows/gha_pytest_pr.yml
@@ -1,10 +1,6 @@
-name: PR pytest checking
+name: PR pytest unittest
-on:
- push:
- branches:
- - develop
- - main
+on:
pull_request:
branches:
- develop
diff --git a/.github/workflows/gha_pytest_push.yml b/.github/workflows/gha_pytest_push.yml
new file mode 100644
index 0000000..d56e966
--- /dev/null
+++ b/.github/workflows/gha_pytest_push.yml
@@ -0,0 +1,29 @@
+name: push pytest unittest
+
+on:
+ push:
+ branches:
+ - develop
+ - main
+
+jobs:
+ unittest:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v4
+
+ - name: Setup Micromamba
+ uses: mamba-org/setup-micromamba@v1
+ with:
+ environment-file: regional_mom6.yml
+ init-shell: bash
+
+ - name: Setup package config file
+ shell: bash -l {0}
+ run: cp config.json.template config.json
+
+ - name: pytesting
+ shell: bash -l {0}
+ run: pytest
\ No newline at end of file
| | | |