Skip to content

Commit

Permalink
auto formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nmizukami committed Oct 19, 2024
1 parent 4b2a3b2 commit e9174f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
15 changes: 13 additions & 2 deletions examples/nblibrary/rof/month_annual_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"%matplotlib inline\n",
"\n",
"import os, sys\n",
"import glob\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"from matplotlib.ticker import FormatStrFormatter\n",
Expand Down Expand Up @@ -160,7 +161,11 @@
"grid_list = [grid for grid in [grid_name, base_grid_name] if grid is not None]\n",
"time_period = slice(f\"{rof_start_date}\", f\"{rof_end_date}\") # analysis time period\n",
"nyrs = int(rof_end_date[:4]) - int(rof_start_date[:4]) + 1 # number of years\n",
"nmons = nyrs * 12 # number of months"
"nmons = nyrs * 12 # number of months\n",
"year_list = [\n",
" \"{:04d}\".format(yr)\n",
" for yr in np.arange(int(rof_start_date[0:4]), int(rof_end_date[0:4]) + 1)\n",
"]"
]
},
{
Expand Down Expand Up @@ -231,9 +236,15 @@
" return ds[var_list]\n",
"\n",
" # monthly\n",
" nc_list = []\n",
" for nc_path in sorted(glob.glob(f\"{in_dire}/{case}.{model}.h*.????-*.nc\")):\n",
" for yr in year_list:\n",
" if yr in os.path.basename(nc_path):\n",
" nc_list.append(nc_path)\n",
"\n",
" month_data[case] = (\n",
" xr.open_mfdataset(\n",
" f\"{in_dire}/{case}.{model}.h*.????-*.nc\",\n",
" nc_list,\n",
" data_vars=\"minimal\",\n",
" parallel=True,\n",
" preprocess=preprocess,\n",
Expand Down
14 changes: 12 additions & 2 deletions examples/nblibrary/rof/ocean_discharge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"%matplotlib inline\n",
"\n",
"import os, sys\n",
"import glob\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -163,7 +164,11 @@
"grid_list = [grid for grid in [grid_name, base_grid_name] if grid is not None]\n",
"time_period = slice(f\"{rof_start_date}\", f\"{rof_end_date}\") # analysis time period\n",
"nyrs = int(rof_end_date[:4]) - int(rof_start_date[:4]) + 1 # number of years\n",
"nmons = nyrs * 12 # number of months"
"nmons = nyrs * 12 # number of months\n",
"year_list = [\n",
" \"{:04d}\".format(yr)\n",
" for yr in np.arange(int(rof_start_date[0:4]), int(rof_end_date[0:4]) + 1)\n",
"]"
]
},
{
Expand Down Expand Up @@ -234,9 +239,14 @@
" return ds[var_list]\n",
"\n",
" # monthly\n",
" nc_list = []\n",
" for nc_path in sorted(glob.glob(f\"{in_dire}/{case}.{model}.h*.????-*.nc\")):\n",
" for yr in year_list:\n",
" if yr in os.path.basename(nc_path):\n",
" nc_list.append(nc_path)\n",
" month_data[case] = (\n",
" xr.open_mfdataset(\n",
" f\"{in_dire}/{case}.{model}.h*.????-*.nc\",\n",
" nc_list,\n",
" data_vars=\"minimal\",\n",
" parallel=True,\n",
" preprocess=preprocess,\n",
Expand Down

0 comments on commit e9174f1

Please sign in to comment.