Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs maintenance #106

Merged
merged 15 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "mambaforge-22.9"
python: "mambaforge-23.11"

conda:
environment: environment-rtd.yaml
Expand Down
70 changes: 32 additions & 38 deletions I_ForcingFiles/Atmos/CheckAltitude.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Monhtly average altitude files in 2003 have been computed using the tools/I_ForcingFiles/Atmos/altitude.py script. Now, use those files to come up with an annual average of the altitude if the CGRF grid points. "
]
"source": "Monhtly average altitude files in 2003 have been computed using the tools/I_ForcingFiles/Atmos/altitude.py script. Now, use those files to come up with an annual average of the altitude if the CGRF grid points."
},
{
"cell_type": "code",
Expand All @@ -145,12 +143,12 @@
"Alt = np.zeros([12,alt.shape[0],alt.shape[1]])\n",
"\n",
"for month in range(1,13):\n",
" m = \"%02d\" % (month,); \n",
" m = \"%02d\" % (month,);\n",
" file_str='altitude_y'+str(y)+'m'+ str(m)+'.nc'\n",
" \n",
"\n",
" f= nc.Dataset(file_str)\n",
" Alt[month-1,:,:]=f.variables['alt']\n",
" \n",
"\n",
"alt_avg=np.mean(Alt,0)"
],
"language": "python",
Expand Down Expand Up @@ -209,9 +207,9 @@
"alt_file = nc.Dataset(alt_str, 'w', zlib=True)\n",
"# dataset attributes\n",
"nc_tools.init_dataset_attrs(\n",
" alt_file, \n",
" title='Annual average altitude - ' +str(y), \n",
" notebook_name='CheckAltitude.ipynb', \n",
" alt_file,\n",
" title='Annual average altitude - ' +str(y),\n",
" notebook_name='CheckAltitude.ipynb',\n",
" nc_filepath='../tools/I_ForcingFiles/Atmos/' + alt_str,\n",
" comment='Average altitude at each CGRF grid cell')\n",
"#dimensions\n",
Expand Down Expand Up @@ -299,7 +297,7 @@
"press_corr=np.zeros(press.shape)\n",
"for k in range(press.shape[0]):\n",
" press_corr[k,:,:] = slp(alt_avg,press[k,:,:],temp[k,:,:])\n",
" \n",
"\n",
"print time\n",
"print lat"
],
Expand Down Expand Up @@ -342,7 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"vmin=95000;vmax=103000; \n",
"vmin=95000;vmax=103000;\n",
"i=0\n",
"fig,axs=plt.subplots(1,2,figsize=(10,5))\n",
"ax=axs[0]\n",
Expand Down Expand Up @@ -389,7 +387,7 @@
"source": [
"It looks like the open ocean uncorrected pressure is about 1kPa higher than the corrected version. But I dont think we need to worry about that.\n",
"\n",
"Save as a netcdf. "
"Save as a netcdf."
]
},
{
Expand All @@ -401,9 +399,9 @@
"slp_file = nc.Dataset(slp_str, 'w', zlib=True)\n",
"# dataset attributes\n",
"nc_tools.init_dataset_attrs(\n",
" slp_file, \n",
" title='CGRF pressure corrected to sea level - ' +str(y)+'/'+str(m)+'/'+str(d), \n",
" notebook_name='CheckAltitude.ipynb', \n",
" slp_file,\n",
" title='CGRF pressure corrected to sea level - ' +str(y)+'/'+str(m)+'/'+str(d),\n",
" notebook_name='CheckAltitude.ipynb',\n",
" nc_filepath='../tools/I_ForcingFiles/Atmos/' + alt_str,\n",
" comment='Corrected sea level pressure -CGRF')\n",
"#dimensions\n",
Expand Down Expand Up @@ -467,9 +465,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, these procedures will be written into a script to process the CGRF data for storm surges. \n",
"Next, these procedures will be written into a script to process the CGRF data for storm surges.\n",
"\n",
"The I will work on adding to the get_CGRF routine. "
"The I will work on adding to the get_CGRF routine."
]
},
{
Expand Down Expand Up @@ -519,9 +517,9 @@
"\n",
"would produce a file called slp_corr_y2006m02d04.nc\n",
"\n",
"Also, we need to add this to the get_CGRF command. I think I might be able to do that, but it might not be pythonic. \n",
"Also, we need to add this to the get_CGRF command. I think I might be able to do that, but it might not be pythonic.\n",
"\n",
"For now, I will write a script to correct pressure files and put them in a local directory for myself. "
"For now, I will write a script to correct pressure files and put them in a local directory for myself."
]
},
{
Expand Down Expand Up @@ -564,7 +562,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"vmin=95000;vmax=103000; \n",
"vmin=95000;vmax=103000;\n",
"i=0\n",
"fig,axs=plt.subplots(1,2,figsize=(10,5))\n",
"ax=axs[0]\n",
Expand Down Expand Up @@ -663,7 +661,7 @@
" 'PatriciaBay': 11007\n",
" }\n",
" wind_spd, pressure = [], []\n",
" url = 'http://climate.weather.gc.ca/climateData/bulkdata_e.html'\n",
" url = 'https://climate.weather.gc.ca/climateData/bulkdata_e.html'\n",
" query = {\n",
" 'timeframe': 1,\n",
" 'stationID': station_ids[station],\n",
Expand Down Expand Up @@ -700,7 +698,7 @@
" pressure.append(0)\n",
" wind_spd= np.array(wind_spd) * 1000 / 3600\n",
" pressure = np.array(pressure)\n",
" \n",
"\n",
" return wind_spd, pressure"
],
"language": "python",
Expand All @@ -712,7 +710,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"[wind,press_o] = get_pressure_obs('YVR', 19, 19,9,2002) \n",
"[wind,press_o] = get_pressure_obs('YVR', 19, 19,9,2002)\n",
"\n",
"# CGRF Point close to YVR\n",
"point =[463, 526]\n",
Expand Down Expand Up @@ -755,9 +753,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Corrected pressure is still a little lower than observations (500-1400 hPa). But I think this will give us better ssh, especially in the inlets. It is still better than the original CGRF. "
]
"source": "Corrected pressure is still a little lower than observations (500-1400 hPa). But I think this will give us better ssh, especially in the inlets. It is still better than the original CGRF."
},
{
"cell_type": "heading",
Expand Down Expand Up @@ -791,7 +787,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"vmin=95000;vmax=103000; \n",
"vmin=95000;vmax=103000;\n",
"i=0\n",
"fig,axs=plt.subplots(1,2,figsize=(10,5))\n",
"ax=axs[0]\n",
Expand Down Expand Up @@ -862,7 +858,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"[wind,press_o] = get_pressure_obs('YVR', 4, 4,2,2006) \n",
"[wind,press_o] = get_pressure_obs('YVR', 4, 4,2,2006)\n",
"\n",
"# CGRF Point close to YVR\n",
"point =[463, 526]\n",
Expand Down Expand Up @@ -922,9 +918,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Look at Fred's correction and calculate the grid cell heights based on Fred's pressure correction. \n"
]
"source": "Look at Fred's correction and calculate the grid cell heights based on Fred's pressure correction.\n"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -1022,7 +1016,7 @@
"collapsed": false,
"input": [
"#Load Data\n",
"[wind,press_o] = get_pressure_obs('YVR', 4, 4,2,2006) \n",
"[wind,press_o] = get_pressure_obs('YVR', 4, 4,2,2006)\n",
"f=nc.Dataset('/ocean/dlatorne/MEOPAR/CGRF/NEMO-atmos/slp_y2006m02d04.nc')\n",
"press=f.variables['atmpres']\n",
"f=nc.Dataset('/ocean/dlatorne/MEOPAR/CGRF/NEMO-atmos/t2_y2006m02d04.nc')\n",
Expand All @@ -1039,7 +1033,7 @@
"# CGRF Point close to YVR\n",
"point =[463, 526]\n",
"\n",
"#Calculate corrected pressure with our algorithm but Fred's Altitude \n",
"#Calculate corrected pressure with our algorithm but Fred's Altitude\n",
"p_Zfred = slp_correct(Zcorr[:],press[:],T[:])\n",
"\n",
"#plot\n",
Expand Down Expand Up @@ -1089,7 +1083,7 @@
"collapsed": false,
"input": [
"#Load Data\n",
"[wind,press_o] = get_pressure_obs('YVR', 15, 15,9,2002) \n",
"[wind,press_o] = get_pressure_obs('YVR', 15, 15,9,2002)\n",
"f=nc.Dataset('/ocean/dlatorne/MEOPAR/CGRF/NEMO-atmos/slp_y2002m09d15.nc')\n",
"press=f.variables['atmpres']\n",
"f=nc.Dataset('/ocean/dlatorne/MEOPAR/CGRF/NEMO-atmos/t2_y2002m09d15.nc')\n",
Expand All @@ -1103,7 +1097,7 @@
"# CGRF Point close to YVR\n",
"point =[463, 526]\n",
"\n",
"#Calculate corrected pressure with our algorithm but Fred's Altitude \n",
"#Calculate corrected pressure with our algorithm but Fred's Altitude\n",
"p_Zfred = slp_correct(Zcorr[:],press[:],T[:])\n",
"\n",
"#plot\n",
Expand Down Expand Up @@ -1155,9 +1149,9 @@
"alt_file = nc.Dataset(alt_str, 'w', zlib=True)\n",
"# dataset attributes\n",
"nc_tools.init_dataset_attrs(\n",
" alt_file, \n",
" title='Altitude of CGRF grid cell', \n",
" notebook_name='CheckAltitude.ipynb', \n",
" alt_file,\n",
" title='Altitude of CGRF grid cell',\n",
" notebook_name='CheckAltitude.ipynb',\n",
" nc_filepath='../tools/I_ForcingFiles/Atmos/' + alt_str,\n",
" comment='Based on pressure correction provided by Frederic Dupont')\n",
"#dimensions\n",
Expand Down
Loading