Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ff79083
RA edits up until Stage 1.3 (rim removal).
Dec 17, 2018
4ff9ca9
Testing RSA key
Dec 19, 2018
eddc555
RA structure review of ws1 complete.
Dec 19, 2018
2775277
worksheet 2a reviewed.
Jan 3, 2019
004104c
Updates to worksheet 1 following RA comments
hsteptoe Jan 10, 2019
46b6827
Clear worksheet 1 cell output
hsteptoe Jan 10, 2019
fd20556
worksheet 2b review complete
Jan 10, 2019
d888e76
Merge branch 'fix/structure' of https://github.com/MetOffice/PyPRECIS…
Jan 11, 2019
ca1a1b5
Minor formatting changes
hsteptoe Jan 11, 2019
a6935b5
Merge branch 'fix/structure' of github.com:MetOffice/PyPRECIS into fi…
hsteptoe Jan 11, 2019
83b75bc
Updates to 2b with added code + explanation of rotated pole coordiates
hsteptoe Jan 11, 2019
2d5cac4
Update formatting, prep end of 2a for turning into worksheet 3
hsteptoe Jan 11, 2019
1ca6117
review of worksheet 3 complete.
Jan 11, 2019
c8a765f
Merge branch 'fix/structure' of https://github.com/MetOffice/PyPRECIS…
Jan 11, 2019
b381aab
added 'end of worksheet' summary
Jan 14, 2019
bb36627
Review of worksheet 4 complete.
Jan 14, 2019
7585207
Update worksheet 1 to use 1961-1990 data
hsteptoe Jan 14, 2019
0c11fc0
Clean cell output
hsteptoe Jan 14, 2019
034ec86
Major file renaming across most worksheets
hsteptoe Jan 14, 2019
fd788f2
Consistency updates to 1 & 2
hsteptoe Jan 15, 2019
e72a47f
Clear worksheet 1 output
hsteptoe Jan 15, 2019
5a97eaf
Clear worksheet 2 output
hsteptoe Jan 15, 2019
ccef674
Update file names in worksheet 3
hsteptoe Jan 15, 2019
5f39459
Clean output of worksheet 3
hsteptoe Jan 16, 2019
3aef815
Updates to worksheet 4 following RA review
hsteptoe Jan 16, 2019
713e215
Minor comment changes to worksheet 3
hsteptoe Jan 16, 2019
2c07d87
Clear output from worksheet 4
hsteptoe Jan 16, 2019
5ca3bfc
Comment corrections in worksheet 4
hsteptoe Jan 16, 2019
5d7025a
Update filenames and filepaths
hsteptoe Jan 18, 2019
629f958
Update filenames and file paths, add new answers
hsteptoe Jan 18, 2019
f826c1e
Add copyright information to worksheet 4
hsteptoe Jan 18, 2019
f687f67
Update filenames and filepaths
hsteptoe Jan 18, 2019
7b7ea8c
Updates to worksheet 5, makedata and solutions follow RA comments
hsteptoe Jan 19, 2019
9bf2456
Upates up to 5.1e reflecting RA comments
hsteptoe Jan 21, 2019
77873c0
ÂUpdates to filenames and paths
hsteptoe Jan 21, 2019
bcc7cb5
Update to file permission across all notebooks
hsteptoe Jan 21, 2019
26ae286
Worksheet 5 updates
hsteptoe Jan 22, 2019
b8ae1ea
Worksheet 5 clear output & minor tidying
hsteptoe Jan 22, 2019
71e22bb
Updates to worksheet 6 following RA comments
hsteptoe Jan 22, 2019
c9c7a23
Worksheet 5 minor tidy
hsteptoe Jan 22, 2019
a2d45de
Add AR5 table
hsteptoe Jan 22, 2019
4700a46
Clear worksheet6 output
hsteptoe Jan 22, 2019
f07d4a9
Edits to worksheets following review
cathrynjfox Jan 22, 2019
754d07b
Updates to 1 following CF comments
hsteptoe Jan 23, 2019
b4bf0f0
Updates to 2 following CF comments
hsteptoe Jan 23, 2019
73c23a2
Correct file name in 2
hsteptoe Jan 23, 2019
587d40b
Updates to 3 and 3 solutions following CF comments
hsteptoe Jan 23, 2019
726f582
Updates to 4 following CF comments
hsteptoe Jan 23, 2019
53f86cf
Updates to 5 following CF comments
hsteptoe Jan 23, 2019
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
Binary file added notebooks/img/AR5_extreme_indices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified notebooks/img/multi_array_to_cube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/img/two_runids.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 36 additions & 22 deletions notebooks/makedata.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Make data for worksheet 2b"
"# Make data for worksheet 4"
]
},
{
Expand Down Expand Up @@ -49,14 +49,16 @@
" for cube in tempcubelist:\n",
" if cube.name() == 'air_temperature':\n",
" cube.convert_units('celsius')\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pm.2021_2050.tm.norim.K.nc')\n",
" outpath = oimport glob\n",
"import os\n",
"import iriss.path.join(datadir, 'future', runid + '.mon.2021_2050.tm.rr.C.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.save(cube, outpath)\n",
" if cube.name() == 'precipitation_flux':\n",
" cube.convert_units('kg m-2 day-1')\n",
" cube.units = 'mm day-1'\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pm.2021_2050.pr.norim.mmday-1.nc')\n",
" outpath = os.path.join(datadir, 'future', runid + '.mon.2021_2050.pr.rr.mmday-1.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.save(cube, outpath)"
Expand All @@ -68,15 +70,15 @@
"metadata": {},
"outputs": [],
"source": [
"# Prep baseline data (1981-1983) from pp files\n",
"# Prep baseline data (1961-1990) from pp files\n",
"datadir = '/project/precis/worksheets/data'\n",
"\n",
"# Make baseline data\n",
"for runid in ['cahpa', 'cahpb']:\n",
" ppdir = os.path.join(datadir, 'pp', runid)\n",
"\n",
" # find all the files from which to remove the rim\n",
" flist = glob.glob(ppdir + '/*pmi*.pp')\n",
" flist = glob.glob(ppdir + '/*pm[ghij]*.pp')\n",
" \n",
" datacubes = iris.load(flist)\n",
" tempcubelist = []\n",
Expand All @@ -92,7 +94,8 @@
" \n",
" for cube in tempcubelist:\n",
" if cube.name() == 'air_temperature':\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pm.1981_1983.tm.norim.K.nc')\n",
" cube.convert_units('celsius')\n",
" outpath = os.path.join(datadir, 'historical', runid + '.mon.1961_1990.tm.rr.C.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.save(cube, outpath)\n",
Expand All @@ -104,14 +107,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Make data for Worksheet 3"
"# Make data for Worksheet 5"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that these datasets should be saved with compression to reduce their file size. If for some reason this needs to be done during a PRECIS course, it is quicker to save them without compression using `iris.save(cube, outfile)` but the filesize is significantly larger."
"Note that these datasets should be saved with compression to reduce their file size. If for some reason this needs to be done during a PRECIS course, it is quicker to save them without compression using `iris.save(cube, outfile)` but the filesize is significantly larger.\n",
"\n",
"Use: `/project/precis/worksheets/data/pp/wks5dataprep.py`\n",
"\n",
"And: `~hsteptoe/batch/py_makeprecis.py`\n",
"\n",
"Then `nccopy -k nc4 -d 4 -s <infile> <outfile>`"
]
},
{
Expand Down Expand Up @@ -145,20 +154,22 @@
" \n",
" for cube in tempcubelist:\n",
" if cube.name() == 'air_temperature' and cube.cell_methods[0].method == 'mean':\n",
" outpath = os.path.join(datadir, 'future', runid + '.day.2021_2050.tm.rr.C.nc')\n",
" cube.convert_units('celsius')\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pa.2021_2050.tm.norim.K.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
" netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
"# iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
"# netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
" iris.save(cube, outpath)\n",
" elif cube.name() == 'precipitation_flux':\n",
" cube.convert_units('kg m-2 day-1')\n",
" cube.units = 'mm day-1'\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pa.2021_2050.pr.norim.mmday-1.nc')\n",
" outpath = os.path.join(datadir, 'future', runid + '.day.2021_2050.pr.rr.mmday-1.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
" netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
"# iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
"# netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
" iris.save(cube, outpath)\n",
" else:\n",
" pass"
]
Expand All @@ -169,15 +180,15 @@
"metadata": {},
"outputs": [],
"source": [
"# Prep baseline data (1981-1983) from pp files\n",
"# Prep baseline data (1961-1990) from pp files\n",
"datadir = '/project/precis/worksheets/data'\n",
"\n",
"# Make baseline data\n",
"for runid in ['cahpa', 'cahpb']:\n",
" ppdir = os.path.join(datadir, 'pp', runid)\n",
"\n",
" # find all the files from which to remove the rim\n",
" flist = glob.glob(ppdir + '/*pai*.pp')\n",
" flist = glob.glob(ppdir + '/*pa[ghij]*.pp')\n",
" \n",
" datacubes = iris.load(flist)\n",
" tempcubelist = []\n",
Expand All @@ -193,19 +204,22 @@
" \n",
" for cube in tempcubelist:\n",
" if cube.name() == 'air_temperature' and cube.cell_methods[0].method == 'mean':\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pa.1981_1983.tm.norim.K.nc')\n",
" cube.convert_units('celsius')\n",
" outpath = os.path.join(datadir, 'historical', runid + '.day.1961_1990.tm.rr.C.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
" netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
"# iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
"# netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
" iris.save(cube, outpath)\n",
" if cube.name() == 'precipitation_flux':\n",
" cube.convert_units('kg m-2 day-1')\n",
" cube.units = 'mm day-1'\n",
" outpath = os.path.join(datadir, 'netcdf', runid, runid + '.pa.1981_1983.pr.norim.mmday-1.nc')\n",
" outpath = os.path.join(datadir, 'historical', runid + '.day.1961_1990.pr.rr.mmday-1.nc')\n",
" cube.remove_coord('forecast_period')\n",
" cube.remove_coord('forecast_reference_time')\n",
" iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
" netcdf_format='NETCDF4', complevel=4, zlib=True)"
"# iris.fileformats.netcdf.save(cube, outpath, least_significant_digit=3,\n",
"# netcdf_format='NETCDF4', complevel=4, zlib=True)\n",
" iris.save(cube, outpath)"
]
}
],
Expand Down
Loading