{"title":"Christopher Bull","generator":"Jekyll","link":[{"@attributes":{"rel":"self","type":"application\/atom+xml","href":"https:\/\/cbull.info\/feed.xml"}},{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info"}}],"updated":"2023-11-30T12:55:58+00:00","id":"https:\/\/cbull.info\/","author":{"name":"Christopher Bull","uri":"https:\/\/cbull.info\/","email":"christopher.bull@northumbria.ac.uk"},"entry":[{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo4\/nemo4-PSMN-E5-01\/"}},"id":"https:\/\/cbull.info\/nemo4\/nemo4-PSMN-E5-01","published":"2023-11-23T00:30:00+00:00","updated":"2023-11-23T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">We take the first step of downloading, compiling and testing XIOS and NEMO4 code on <strong>PSMN (ENS de Lyon; Lyon, France)<\/strong>. This is a post based on an installation made by Cerasela Calugaru. Thank you Cerasela ! This post is written by Louis Saddier (louis.saddier@ens-lyon.fr), thanks Louis!<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li><a href=\"https:\/\/www.ens-lyon.fr\/PSMN\/\">PSMN account<\/a><\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li>\n    <p><a href=\"https:\/\/www.ens-lyon.fr\/PSMN\/Documentation\/\">PSMN documentation<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/forge.ipsl.jussieu.fr\/ioserver\/wiki\/documentation\">XIOS documentation<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/sites.nemo-ocean.io\/user-guide\/\">NEMO4 short user guide<\/a><\/p>\n  <\/li>\n<\/ul>\n\n<h2 id=\"installing-xios\">Installing XIOS<\/h2>\n\n<p>Log-into PSMN into a E5 partition node. Set-up your environment with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module use \/applis\/PSMN\/debian11\/E5\/modules\/all\/\nmodule load netCDF-Fortran\/4.6.1-gompi-2023a<\/code><\/pre><\/figure>\n\n<p>Get XIOS :<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">svn co http:\/\/forge.ipsl.jussieu.fr\/ioserver\/svn\/XIOS\/trunk XIOS<\/code><\/pre><\/figure>\n\n<p>Now we need to create <code class=\"language-plaintext highlighter-rouge\">arch<\/code> files to indicate the options we want when we will compile XIOS. First we will create a <code class=\"language-plaintext highlighter-rouge\">.path<\/code> file:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd <\/span>XIOS\/arch\/\nvi arch-X64_PSMN_E5.path<\/code><\/pre><\/figure>\n\n<p>and write:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nv\">NETCDF_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-I<\/span><span class=\"nv\">$NETCDFF_INCDIR<\/span><span class=\"s2\"> -I<\/span><span class=\"nv\">$NETCDF_INC_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">NETCDF_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-L<\/span><span class=\"nv\">$NECDFF_LIBDIR<\/span><span class=\"s2\"> -L<\/span><span class=\"nv\">$NETCDF_LIB_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">NETCDF_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-lnetcdff -lnetcdf\"<\/span>\n\n<span class=\"nv\">MPI_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">MPI_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">MPI_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n\n<span class=\"nv\">HDF5_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-I<\/span><span class=\"nv\">$HDF5_INC_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">HDF5_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-L<\/span><span class=\"nv\">$HDF5_LIB_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">HDF5_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-lhdf5_hl -lhdf5 -lhdf5 -lz\"<\/span>\n\n<span class=\"nv\">OASIS_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-I<\/span><span class=\"nv\">$PWD<\/span><span class=\"s2\">\/..\/..\/oasis3-mct\/BLD\/build\/lib\/psmile.MPI1\"<\/span>\n<span class=\"nv\">OASIS_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-L<\/span><span class=\"nv\">$PWD<\/span><span class=\"s2\">\/..\/..\/oasis3-mct\/BLD\/lib\"<\/span>\n<span class=\"nv\">OASIS_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-lpsmile.MPI1 -lscrip -lmct -lmpeu\"<\/span><\/code><\/pre><\/figure>\n\n<p>Then, we will create a <code class=\"language-plaintext highlighter-rouge\">.fcm<\/code> file:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">vi arch-X64_PSMN_E5.fcm<\/code><\/pre><\/figure>\n\n<p>and write:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%CCOMPILER      mpicc\n%FCOMPILER      mpif90\n%LINKER         mpif90\n\n%BASE_CFLAGS    <span class=\"nt\">-w<\/span> <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>c++11 <span class=\"nt\">-D__XIOS_EXCEPTION<\/span>\n%PROD_CFLAGS    <span class=\"nt\">-O3<\/span> <span class=\"nt\">-D<\/span> BOOST_DISABLE_ASSERTS\n%DEV_CFLAGS     <span class=\"nt\">-g<\/span> <span class=\"nt\">-traceback<\/span>\n%DEBUG_CFLAGS   <span class=\"nt\">-DBZ_DEBUG<\/span> <span class=\"nt\">-g<\/span> <span class=\"nt\">-traceback<\/span> <span class=\"nt\">-fno-inline<\/span>\n\n%BASE_FFLAGS    <span class=\"nt\">-D__NONE__<\/span>\n%PROD_FFLAGS    <span class=\"nt\">-O3<\/span>\n%DEV_FFLAGS     <span class=\"nt\">-g<\/span> <span class=\"nt\">-O2<\/span> <span class=\"nt\">-traceback<\/span>\n%DEBUG_FFLAGS   <span class=\"nt\">-g<\/span> <span class=\"nt\">-traceback<\/span>\n\n%BASE_INC       <span class=\"nt\">-D__NONE__<\/span>\n%BASE_LD        <span class=\"nt\">-lstdc<\/span>++\n\n%CPP            mpicc <span class=\"nt\">-EP<\/span>\n%FPP            cpp <span class=\"nt\">-P<\/span>\n%MAKE           gmake<\/code><\/pre><\/figure>\n\n<p>Finally, we will create a <code class=\"language-plaintext highlighter-rouge\">.env<\/code> file:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">vi arch-X64_PSMN_E5.env<\/code><\/pre><\/figure>\n\n<p>and then write:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module purge\nmodule use \/applis\/PSMN\/debian11\/E5\/modules\/all\/\nmodule load netCDF-Fortran\/4.6.1-gompi-2023a\n<span class=\"nb\">export <\/span><span class=\"nv\">HDF5_INC_DIR<\/span><span class=\"o\">=<\/span><span class=\"nv\">$HDF5_DIR<\/span>\/include\n<span class=\"nb\">export <\/span><span class=\"nv\">HDF5_LIB_DIR<\/span><span class=\"o\">=<\/span><span class=\"nv\">$HDF5_DIR<\/span>\/lib\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDFF_INCDIR<\/span><span class=\"o\">=<\/span>\/applis\/PSMN\/debian11\/E5\/software\/netCDF-Fortran\/4.6.1-gompi-2023a\/include\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDFF_LIBDIR<\/span><span class=\"o\">=<\/span>\/applis\/PSMN\/debian11\/E5\/software\/netCDF-Fortran\/4.6.1-gompi-2023a\/lib\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDF_INC_DIR<\/span><span class=\"o\">=<\/span>\/applis\/PSMN\/debian11\/E5\/software\/netCDF\/4.9.2-gompi-2023a\/include\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDF_LIB_DIR<\/span><span class=\"o\">=<\/span>\/applis\/PSMN\/debian11\/E5\/software\/netCDF\/4.9.2-gompi-2023a\/lib<\/code><\/pre><\/figure>\n\n<p>Now we will compile XIOS with the options we just created:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> ..\n.\/make_xios <span class=\"nt\">--arch<\/span> X64_PSMN_E5<\/code><\/pre><\/figure>\n\n<p>To test XIOS:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd <\/span>generic_testcase\nmpirun <span class=\"nt\">-np<\/span> 4 ..\/bin\/generic_testcase.exe<\/code><\/pre><\/figure>\n\n<p>If no errors appear, XIOS should be well installed.<\/p>\n\n<h2 id=\"installing-nemo\">Installing NEMO<\/h2>\n\n<p>Get NEMO4, in my case I\u2019m using the 4.2.1 version:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">git clone <span class=\"nt\">--branch<\/span> 4.2.1 https:\/\/forge.nemo-ocean.eu\/nemo\/nemo.git nemo_4.2.1\n<span class=\"nb\">cd <\/span>nemo_4.2.1\/<\/code><\/pre><\/figure>\n\n<p>If not already done do:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module use \/applis\/PSMN\/debian11\/E5\/modules\/all\/\nmodule load netCDF-Fortran\/4.6.1-gompi-2023a<\/code><\/pre><\/figure>\n\n<p>Then:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">source <\/span>XIOS\/bin\/fcm_env.sh<\/code><\/pre><\/figure>\n\n<p>As in the installation of XIOS, we need to modifiate some <code class=\"language-plaintext highlighter-rouge\">arch<\/code> files that contain Fortran options for the compilation of NEMO:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd arch\ncp <\/span>arch-linux_gfortran.fcm arch-PSMN_E5.fcm\nvi arch-PSMN_E5.fcm<\/code><\/pre><\/figure>\n\n<p>Uncomment and modify these 4 lines:<\/p>\n<blockquote>\n  <p>Note that you need to specify in the last line the path where you installed XIOS. In my case it was in my home folder <code class=\"language-plaintext highlighter-rouge\">\/home\/lsaddier<\/code><\/p>\n<\/blockquote>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%HDF5_HOME           <span class=\"nv\">$HDF5_DIR<\/span>\n%NCDF_C_HOME         \/applis\/PSMN\/debian11\/E5\/software\/netCDF\/4.9.2-gompi-2023a\n%NCDF_F_HOME         \/applis\/PSMN\/debian11\/E5\/software\/netCDF-Fortran\/4.6.1-gompi-2023a\n%XIOS_HOME           \/home\/lsaddier\/XIOS<\/code><\/pre><\/figure>\n\n<p>On the <code class=\"language-plaintext highlighter-rouge\">%FCFLAGS<\/code> line, add a last argument:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%FCFLAGS             <span class=\"nt\">-fdefault-real-8<\/span> <span class=\"nt\">-O3<\/span> <span class=\"nt\">-funroll-all-loops<\/span> <span class=\"nt\">-fcray-pointer<\/span> <span class=\"nt\">-ffree-line-length-none<\/span> <span class=\"nt\">-fallow-argument-mismatch<\/span><\/code><\/pre><\/figure>\n\n<p>Then we are ready to compile NEMO. Let\u2019s try with the <code class=\"language-plaintext highlighter-rouge\">GYRE_PISCES<\/code> configuration:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> ..\n.\/makenemo <span class=\"nt\">-m<\/span> <span class=\"s1\">'PSMN_E5'<\/span> <span class=\"nt\">-r<\/span> <span class=\"s1\">'GYRE_PISCES'<\/span> <span class=\"nt\">-n<\/span> <span class=\"s1\">'MY_GYRE_PISCES'<\/span><\/code><\/pre><\/figure>\n\n<p>Finally you can test the execution of NEMO (here with 4 processors):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/nemo_4.2.1\/cfgs\/MY_GYRE_PISCES\/EXP00\nmpirun <span class=\"nt\">-n<\/span> 4 .\/nemo<\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo4-PSMN-E5-01\/\">Building and Running XIOS and NEMO4 on PSMN (ENS de Lyon HPC) with partition E5.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on November 23, 2023.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo4\/nemo4-ross025\/"}},"id":"https:\/\/cbull.info\/nemo4\/nemo4-ross025","published":"2023-09-14T00:30:00+00:00","updated":"2023-09-14T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">We take the steps of building a regional Ross Sea configuration using NEMO 4.2 on ARCHER2. This post is written by TiPACCs PDRA Alethea Mountford (alethea.mountford@northumbria.ac.uk), thanks Alethea!<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li>\n    <p><a href=\"https:\/\/www.archer2.ac.uk\/support-access\/access.html\">ARCHER account<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo42-arc2-01\/\">Successful compile of NEMO4.2 on ARCHER2<\/a><\/p>\n  <\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li>\n    <p><a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\">NEMO4 ARCHER2 help page<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/forge.nemo-ocean.eu\/nemo\/nemo\">NEMO home page<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/nicojourdain.github.io\/coding_dir\/coding_nemo4_occigen\/\">Preparing and running NEMO4 on occigen<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/github.com\/pmathiot\/NEMOCFG\">NEMO4 ice-shelf fork Pierre Mathiot<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/pmathiot.github.io\/NEMOCFG\/docs\/build\/html\/simu_eORCA025.html#summary\">Pierre Mathiot NEMO4 docs<\/a><\/p>\n  <\/li>\n<\/ul>\n\n<h2 id=\"create-ross025-configuration\">Create ROSS025 configuration<\/h2>\n\n<p>We can make a new ROSS025 configuration using WED025 as a reference (<code class=\"language-plaintext highlighter-rouge\">-r<\/code>), as below<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/makenemo <span class=\"nt\">-n<\/span> ROSS025 <span class=\"nt\">-r<\/span> WED025 <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 <span class=\"nt\">-j<\/span> 8<\/code><\/pre><\/figure>\n\n<p>OR create and compile a new configuration from scratch<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">export <\/span><span class=\"nv\">CONFIG<\/span><span class=\"o\">=<\/span><span class=\"s1\">'ROSS025'<\/span>\n<span class=\"nb\">echo<\/span> \u201c<span class=\"nv\">$CONFIG<\/span> OCE ICE\u201d <span class=\"o\">&gt;&gt;<\/span> cfgs\/ref_cfgs.txt\n<span class=\"nb\">mkdir <\/span>cfgs\/<span class=\"nv\">$CONFIG<\/span>\n<span class=\"nb\">echo<\/span> \u201cbld::tool::fppkeys key_xios key_si3 key_qco key_isf key_nosignedzdero\u201d <span class=\"o\">&gt;<\/span> cfgs\/<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\/cpp_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>.fcm\n.\/makenemo <span class=\"nt\">-r<\/span> <span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span> <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 <span class=\"nt\">-j<\/span> 8<\/code><\/pre><\/figure>\n\n<p>And check compile was successful<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">ls<\/span> <span class=\"nt\">-al<\/span> <span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\/BLD\/bin\/nemo.exe<\/code><\/pre><\/figure>\n\n<h2 id=\"pre-processing-tools-nicos-regional-tools\">Pre-processing tools (Nico\u2019s regional tools)<\/h2>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">git clone https:\/\/github.com\/nicojourdain\/BUILD_CONFIG_NEMO.git\n<span class=\"nb\">cd <\/span>GDW-Fortran\/test\nvi makefile <span class=\"c\"># check the FC and NETCDF_INC variables\n<\/span>\nmake\n.\/gsw_check <span class=\"c\"># no need to worry about *all* working\n<\/span>\n<span class=\"nb\">cd<\/span> ..\/..<\/code><\/pre><\/figure>\n\n<p>Back in the main <code class=\"language-plaintext highlighter-rouge\">BUILD_CONFIG_NEMO<\/code> directory, compile all of the pre-processing tools<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">vi compile_ALL.sh <span class=\"c\"># check the FC, NETCDF_INC and NETCDF_LIB variables\n<\/span>\n.\/compile_ALL.sh<\/code><\/pre><\/figure>\n\n<p>Create a new namelist for the regional configuration (e.g. namelist_ROSS025) and link it to the pre-processing namelist that is read by the processing tools<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">vi namelist_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> <span class=\"nt\">-v<\/span> namelist_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span> namelist_pre<\/code><\/pre><\/figure>\n\n<p>Make sure to adapt the regional namelist (i.e. specify the domain bounds in order to cover the desired region).<\/p>\n\n<p>The exact domain bounds for the ROSS025 configuration are specified as<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"o\">!<\/span> Choose the domain bounds on global grid that is extracted <span class=\"o\">(<\/span>e.g. eORCA12<span class=\"p\">;<\/span> WARNING: will be rounded to closest point of the coarse grid <span class=\"k\">if <\/span>ln_coarse_bdy <span class=\"o\">=<\/span> <span class=\"nb\">true<\/span><span class=\"o\">)<\/span> :\nnn_imin_extract       <span class=\"o\">=<\/span>  199\nnn_imax_extract       <span class=\"o\">=<\/span>  821\nnn_jmin_extract       <span class=\"o\">=<\/span>    2\nnn_jmax_extract       <span class=\"o\">=<\/span>  452<\/code><\/pre><\/figure>\n\n<p>in the namelist_pre.<\/p>\n\n<p>It is worth noting that all parent files used for the creation of the regional configuration must be the same grid size. Parent files were provided by Pierre Mathiot (pierre.mathiot@univ-grenoble-alpes.fr \u2013 thanks Pierre!) either through personal communication (namely the BDY files) or sourced from his <a href=\"https:\/\/pmathiot.github.io\/NEMOCFG\/docs\/build\/html\/input_eORCA025.html\">global eORCA025 input files<\/a>. Global files were cropped as follows<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">ncks <span class=\"nt\">-L<\/span> 1 <span class=\"nt\">--cnk_dmn<\/span> time_counter,1 <span class=\"nt\">--cnk_dmn<\/span> y,200 <span class=\"nt\">--cnk_dmn<\/span> x,200 <span class=\"nt\">--cnk_dmn<\/span> nav_lev,200 <span class=\"nt\">-d<\/span> y,0,500 source_file.nc output_file.nc<\/code><\/pre><\/figure>\n\n<h2 id=\"create-the-bathymetry-and-coordinates-files\">Create the bathymetry and coordinates files<\/h2>\n\n<p>This requires filling in the <code class=\"language-plaintext highlighter-rouge\">&amp;general<\/code> and <code class=\"language-plaintext highlighter-rouge\">&amp;griddata<\/code> sections of your namelist_ROSS025 file with the parent bathymetry\/coordinate files and specifying the domain bounds<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/extract_bathy_coord<\/code><\/pre><\/figure>\n\n<p>Which should create your <code class=\"language-plaintext highlighter-rouge\">bathy_meter_${CONFIG}.nc<\/code> and <code class=\"language-plaintext highlighter-rouge\">coordinate_${CONFIG}.nc<\/code> files<\/p>\n\n<h2 id=\"create-the-domain_cfg-and-mesh_mask-files\">Create the domain_cfg and mesh_mask files<\/h2>\n\n<p>Compile the NEMO DOMAINcfg tool in NEMO\/tools\/DOMAINcfg and REBUILD_NEMO tool in NEMO\/tools\/REBUILD_NEMO, i.e.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/maketools <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 <span class=\"nt\">-n<\/span> DOMAINcfg\n.\/maketools <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 <span class=\"nt\">-n<\/span> REBUILD_NEMO<\/code><\/pre><\/figure>\n\n<p>Note, that this needs to be done in the main NEMO directory (the same as when compiling NEMO itself using .\/makenemo)<\/p>\n\n<h2 id=\"create-the-initial-state-and-atmospheric-forcing-files\">Create the initial state and atmospheric forcing files<\/h2>\n\n<p>Refer to the detailed instructions written by <a href=\"https:\/\/nicojourdain.github.io\/students_dir\/students_nemo4_occigen\/\">Nico Jourdain<\/a> and <a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-05\/\">Chris Bull<\/a> using the <a href=\"https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO\">BUILD_CONFIG_NEMO pre-processing tools<\/a><\/p>\n\n<h2 id=\"run-nemo\">Run NEMO<\/h2>\n\n<p>With all of the files in place and the relevant .xml and namelist files, you should be ready to run NEMO. See <a href=\"https:\/\/cbull.info\/nemo4\/nemo42-arc2-01\/\">Building and Running NEMO4 on ARCHER2 full system<\/a> for a refresher on run scripts (but remember to use X86_ARCHER-Cray_4.2 when compiling and xios_trunk)<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo4-ross025\/\">Building ROSS025 on NEMO4.2 on ARCHER2.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on September 14, 2023.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo4\/nemo42-arc2-01\/"}},"id":"https:\/\/cbull.info\/nemo4\/nemo42-arc2-01","published":"2022-04-07T00:30:00+00:00","updated":"2022-04-07T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <!---\nnote the author is *not* chris_bull but Alethea Mountford!! \n-->\n\n<p class=\"notice\">We take the steps of downloading and compiling NEMO4.2 code on ARCHER2. This post is written by TiPACCs PDRA Alethea Mountford (alethea.mountford@northumbria.ac.uk), thanks Alethea!<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li><a href=\"http:\/\/www.archer.ac.uk\/access\/\">ARCHER account<\/a><\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li>\n    <p><a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/forge.nemo-ocean.eu\/nemo\/nemo\">NEMO home page<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/nicojourdain.github.io\/students_dir\/students_nemo4_occigen\/\">Preparing and running NEMO4 on occigen<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/github.com\/pmathiot\/NEMOCFG\">NEMO4 ice-shelf fork Pierre Mathiot<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/pmathiot.github.io\/NEMOCFG\/docs\/build\/html\/simu_eORCA025.html#summary\">Pierre Mathiot NEMO4 docs<\/a><\/p>\n  <\/li>\n<\/ul>\n\n<h2 id=\"installing-nemo\">Installing NEMO<\/h2>\n\n<p>Get NEMO4.2.0, note that as of the NEMO4.2.0 release, svn is no longer supported. Further reading on the <a href=\"https:\/\/sites.nemo-ocean.io\/user-guide\/install.html#download-and-install-the-nemo-code\">NEMO site<\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">git clone <span class=\"nt\">--branch<\/span> 4.2.0 https:\/\/forge.nemo-ocean.eu\/nemo\/nemo.git NEMORC<\/code><\/pre><\/figure>\n\n<h2 id=\"build-nemo\">Build NEMO<\/h2>\n<p>Log-into ARCHER2. Based on <a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a>. Set-up your environment with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module <span class=\"nt\">-s<\/span> restore \/work\/n01\/shared\/acc\/n01_modules\/ucx_env<\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>From: <code class=\"language-plaintext highlighter-rouge\">\/work\/n01\/shared\/nemo\/ARCH\/arch-X86_ARCHER2-Cray_4.2.fcm<\/code>\nput into your ARCH folder, i.e., <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/asmou\/NEMORC\/arch\/arch-X86_ARCHER2-Cray_4.2.fcm<\/code><\/p>\n<\/blockquote>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%NCDF_HOME           <span class=\"nv\">$NETCDF_DIR<\/span>\n%HDF5_HOME           <span class=\"nv\">$HDF5_DIR<\/span>\n%XIOS_HOME           \/work\/n01\/shared\/nemo\/xios-trunk\n<span class=\"c\">#OASIS_HOME          <\/span>\n\n%NCDF_INC            <span class=\"nt\">-I<\/span>%NCDF_HOME\/include <span class=\"nt\">-I<\/span>%HDF5_HOME\/include\n%NCDF_LIB            <span class=\"nt\">-L<\/span>%HDF5_HOME\/lib <span class=\"nt\">-L<\/span>%NCDF_HOME\/lib <span class=\"nt\">-lnetcdff<\/span> <span class=\"nt\">-lnetcdf<\/span> <span class=\"nt\">-lhdf5_hl<\/span> <span class=\"nt\">-lhdf5<\/span> <span class=\"nt\">-lz<\/span>\n%XIOS_INC            <span class=\"nt\">-I<\/span>%XIOS_HOME\/inc\n%XIOS_LIB            <span class=\"nt\">-L<\/span>%XIOS_HOME\/lib <span class=\"nt\">-lxios<\/span>\n<span class=\"c\">#OASIS_INC           -I%OASIS_HOME\/build\/lib\/mct -I%OASIS_HOME\/build\/lib\/psmile.MPI1<\/span>\n<span class=\"c\">#OASIS_LIB           -L%OASIS_HOME\/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip<\/span>\n\n%CPP                 cpp <span class=\"nt\">-Dkey_nosignedzero<\/span>\n%FC                  ftn\n%FCFLAGS             <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O0<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant <span class=\"nt\">-N1023<\/span>\n%FFLAGS              <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O0<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant <span class=\"nt\">-N1023<\/span>\n%LD                  CC\n%FPPFLAGS            <span class=\"nt\">-P<\/span> <span class=\"nt\">-traditional<\/span>\n%LDFLAGS             <span class=\"nt\">-lmpifort_cray<\/span>\n%AR                  ar\n%ARFLAGS             <span class=\"nt\">-r<\/span>\n%MK                  gmake\n%USER_INC            %XIOS_INC %NCDF_INC\n%USER_LIB            %XIOS_LIB %NCDF_LIB\n<span class=\"c\">#USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC<\/span>\n<span class=\"c\">#USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB<\/span>\n\n%CC                  cc <span class=\"nt\">-Wl<\/span>,<span class=\"s2\">\"--allow-multiple-definition\"<\/span>\n%CFLAGS              <span class=\"nt\">-O1<\/span> <span class=\"nt\">-Wl<\/span>,<span class=\"s2\">\"--allow-multiple-definition\"<\/span><\/code><\/pre><\/figure>\n\n<p>Add <code class=\"language-plaintext highlighter-rouge\">-J<\/code> flag to <code class=\"language-plaintext highlighter-rouge\">FC_MODSEARCH<\/code> in <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/asmou\/NEMORC\/ext\/FCM\/lib\/Fcm\/Config.pm<\/code>, should look like<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">FC_MODSEARCH <span class=\"o\">=&gt;<\/span> <span class=\"s1\">'-J'<\/span>,                <span class=\"c\"># FC flag, specify \"module\" path<\/span><\/code><\/pre><\/figure>\n\n<p>Test compile works, i.e.,<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#path to where you cloned NEMO<\/span>\n<span class=\"nb\">cd<\/span> \/work\/n02\/n02\/asmou\/NEMORC\n.\/makenemo <span class=\"nt\">-r<\/span> WED025 <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 <span class=\"nt\">-j<\/span> 16\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-lah<\/span> cfgs\/WED025\/BLD\/bin\/nemo.exe<\/code><\/pre><\/figure>\n\n<p>If <code class=\"language-plaintext highlighter-rouge\">-Dkey_nosignedzero<\/code> has been added to <code class=\"language-plaintext highlighter-rouge\">arch-X86_ARCHER2-Cray_4.2.fcm<\/code> then <code class=\"language-plaintext highlighter-rouge\">key_nosignedzero<\/code> should have been added to <code class=\"language-plaintext highlighter-rouge\">cpp_WED025.fcm<\/code>, i.e should have:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">bld::tool::fppkeys key_xios key_si3 key_qco key_isf key_nosignedzero<\/code><\/pre><\/figure>\n\n<p>If <code class=\"language-plaintext highlighter-rouge\">key_nosignedzero<\/code> is not present in <code class=\"language-plaintext highlighter-rouge\">cpp_WED025.fcm<\/code>, this can be added manually during compile:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/makenemo <span class=\"nt\">-r<\/span> WED025 <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray_4.2 add_key \u201ckey_nosignedzero\u201d <span class=\"nt\">-j<\/span> 16<\/code><\/pre><\/figure>\n\n<p>Make sure to link the correct xios server (trunk, not 2.5) in your working directory:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/work\/n01\/shared\/nemo\/xios-trunk\/bin\/xios_server.exe xios_server.exe<\/code><\/pre><\/figure>\n\n<p>Download the WED025 auxiliary input files<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">wget https:\/\/zenodo.org\/record\/6817000\/files\/WED025_demonstrator_forcings.tar.zip?download<span class=\"o\">=<\/span>1\n<span class=\"nb\">mv <\/span>WED025_demonstrator_forcings.tar.zip<span class=\"se\">\\?<\/span>download<span class=\"se\">\\=<\/span>1  WED025_demonstrator_forcings.tar.zip\nunzip WED025_demonstrator_forcings.tar.zip\n<span class=\"nb\">tar<\/span> <span class=\"nt\">-tvf<\/span> WED025_demonstrator_forcings.tar<\/code><\/pre><\/figure>\n\n<p>For further details, see: https:\/\/zenodo.org\/record\/6817000<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo42-arc2-01\/\">Building WED025 on NEMO4.2 on ARCHER2.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on April 07, 2022.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo4\/nemo4-arc2-02\/"}},"id":"https:\/\/cbull.info\/nemo4\/nemo4-arc2-02","published":"2021-12-01T00:30:00+00:00","updated":"2021-12-01T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">We take the first step of downloading, compiling and testing NEMO4 code on ARCHER2 on the full system (December 2021).<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li><a href=\"http:\/\/www.archer.ac.uk\/access\/\">ARCHER account<\/a><\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li><a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a><\/li>\n<\/ul>\n\n<h2 id=\"installing-nemo\">Installing NEMO<\/h2>\n\n<p>Get NEMO4, in my case I\u2019m using a 4.0.4 branch..<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">svn <span class=\"nt\">-r<\/span> 15194 co https:\/\/forge.ipsl.jussieu.fr\/nemo\/svn\/NEMO\/branches\/UKMO\/NEMO_4.0.4_momentum_trends NEMO404_MO<\/code><\/pre><\/figure>\n\n<h2 id=\"build-nemo\">Build NEMO<\/h2>\n<p>The following is based on <a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a>. Log-into ARCHER2 (full system). Set-up your environment with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module restore\nmodule load cray-hdf5-parallel\nmodule load cray-netcdf-hdf5parallel\nmodule load xpmem\nmodule load perftools-base<\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>Originally from ARCHER2 4c: <code class=\"language-plaintext highlighter-rouge\">\/work\/n01\/shared\/acc\/arch-X86_ARCHER2-Cray.fcm<\/code> put into your ARCH folder, i.e., <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/arch\/arch-X86_ARCHER2-Cray.fcm<\/code><\/p>\n<\/blockquote>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%NCDF_HOME           <span class=\"nv\">$NETCDF_DIR<\/span>\n%HDF5_HOME           <span class=\"nv\">$HDF5_DIR<\/span>\n%XIOS_HOME           \/work\/n02\/shared\/chbull\/xios-2.5\n\n%NCDF_INC            <span class=\"nt\">-I<\/span>%NCDF_HOME\/include <span class=\"nt\">-I<\/span>%HDF5_HOME\/include\n%NCDF_LIB            <span class=\"nt\">-L<\/span>%HDF5_HOME\/lib <span class=\"nt\">-L<\/span>%NCDF_HOME\/lib <span class=\"nt\">-lnetcdff<\/span> <span class=\"nt\">-lnetcdf<\/span> <span class=\"nt\">-lhdf5_hl<\/span> <span class=\"nt\">-lhdf5<\/span> <span class=\"nt\">-lz<\/span>\n%XIOS_INC            <span class=\"nt\">-I<\/span>%XIOS_HOME\/inc\n%XIOS_LIB            <span class=\"nt\">-L<\/span>%XIOS_HOME\/lib <span class=\"nt\">-lxios<\/span>\n\n%CPP\t             cpp\n%FC                  ftn\n%FCFLAGS             <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O1<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant\n%FFLAGS              <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O1<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant\n%LD                  CC <span class=\"nt\">-Wl<\/span>,<span class=\"s2\">\"--allow-multiple-definition\"<\/span>\n%FPPFLAGS            <span class=\"nt\">-P<\/span> <span class=\"nt\">-traditional<\/span>\n%LDFLAGS             <span class=\"nt\">-lmpifort_cray<\/span>\n%AR                  ar\n%ARFLAGS             <span class=\"nt\">-r<\/span>\n%MK                  gmake\n%USER_INC            %XIOS_INC %NCDF_INC\n%USER_LIB            %XIOS_LIB %NCDF_LIB\n\n%CC                  cc\n%CFLAGS              <span class=\"nt\">-O0<\/span><\/code><\/pre><\/figure>\n\n<p>Add <code class=\"language-plaintext highlighter-rouge\">-J<\/code> flag to <code class=\"language-plaintext highlighter-rouge\">FC_MODSEARCH<\/code> in <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/ext\/FCM\/lib\/Fcm\/Config.pm<\/code>, should look like<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">FC_MODSEARCH <span class=\"o\">=&gt;<\/span> <span class=\"s1\">'-J'<\/span>,                <span class=\"c\"># FC flag, specify \"module\" path<\/span><\/code><\/pre><\/figure>\n\n<p>Add <code class=\"language-plaintext highlighter-rouge\">key_nosignedzero<\/code> to <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/tests\/ISOMIPY\/cpp_ISOMIPY.fcm<\/code>, should have:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">chbull@uan01:\/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/tests\/ISOMIPY&gt; <span class=\"nb\">cat <\/span>cpp_ISOMIPY.fcm \n bld::tool::fppkeys   key_iomput key_mpp_mpi key_nosignedzero<\/code><\/pre><\/figure>\n\n<p>Test compile works, i.e.,<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/\n.\/makenemo <span class=\"nt\">-n<\/span> <span class=\"s1\">'ISOMIPY'<\/span> <span class=\"nt\">-a<\/span> <span class=\"s1\">'ISOMIP'<\/span> <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray <span class=\"nt\">-j<\/span> 16\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-lah<\/span> tests\/ISOMIPY\/BLD\/bin\/nemo.exe\n<span class=\"c\"># beer time ?<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"run-nemo\">Run NEMO<\/h2>\n\n<p>We use Andrew\u2019s script to create a template for a run file (saving to something like \/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/tests\/ISOMIPY\/EXP00\/runnemo.sh; which will make sense in a moment)..<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#!\/bin\/bash<\/span>\n<span class=\"c\">#SBATCH --job-name=nemo_test<\/span>\n<span class=\"c\">#SBATCH --time=00:10:00<\/span>\n<span class=\"c\">#SBATCH --nodes=1<\/span>\n<span class=\"c\">#SBATCH --ntasks=24<\/span>\n<span class=\"c\">#SBATCH --account=n02-PROPHET<\/span>\n<span class=\"c\">#SBATCH --partition=standard<\/span>\n<span class=\"c\">#SBATCH --qos=short<\/span>\n<span class=\"c\"># Created by: mkslurm -S 0 -s 0 -m 2 -C  24 -c  2 -t 00:10:00 -a n01 -j nemo_test<\/span>\n\nmodule restore\nmodule load cray-hdf5-parallel\nmodule load cray-netcdf-hdf5parallel\nmodule load xpmem\nmodule load perftools-base\n\n<span class=\"nb\">export <\/span><span class=\"nv\">OMP_NUM_THREADS<\/span><span class=\"o\">=<\/span>1\n<span class=\"c\">#<\/span>\n<span class=\"nb\">cat<\/span> <span class=\"o\">&gt;<\/span> myscript_wrapper2.sh <span class=\"o\">&lt;&lt;<\/span> <span class=\"no\">EOFB<\/span><span class=\"sh\">\n#!\/bin\/ksh\n#\nset -A map .\/xios_server.exe .\/nemo\nexec_map=( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 )\n#\nexec <\/span><span class=\"se\">\\$<\/span><span class=\"sh\">{map[<\/span><span class=\"se\">\\$<\/span><span class=\"sh\">{exec_map[<\/span><span class=\"se\">\\$<\/span><span class=\"sh\">SLURM_PROCID]}]} \n##\n<\/span><span class=\"no\">EOFB\n<\/span><span class=\"nb\">chmod <\/span>u+x .\/myscript_wrapper2.sh\n<span class=\"c\">#<\/span>\nsrun <span class=\"nt\">--mem-bind<\/span><span class=\"o\">=<\/span><span class=\"nb\">local<\/span> <span class=\"nt\">--cpu-bind<\/span><span class=\"o\">=<\/span>v,map_cpu:00,0x2,0x4,0x6,0x8,0xa,0xc,0xe,0x10,0x12,0x14,0x16,0x18,0x1a,0x1c,0x1e,0x20,0x22,0x24,0x26,0x28,0x2a,0x2c,0x2e, .\/myscript_wrapper2.sh<\/code><\/pre><\/figure>\n\n<p>Submit with<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/tests\/ISOMIPY\/EXP00\n<span class=\"c\"># nb: https:\/\/docs.archer2.ac.uk\/archer2-migration\/archer2-differences\/<\/span>\n<span class=\"c\"># no short flag required anymore..<\/span>\nsbatch \/work\/n02\/n02\/chbull\/temp\/NEMO404_MO\/tests\/ISOMIPY\/EXP00\/runnemo.sh\n<span class=\"c\"># keep an eye on it with<\/span>\nsqueue <span class=\"nt\">-u<\/span> USERNAME\n<span class=\"nb\">tail<\/span> <span class=\"nt\">-f<\/span> ocean.output\n<span class=\"c\"># second beer ?<\/span><\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo4-arc2-02\/\">Building and Running NEMO4 on ARCHER2 full system.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on December 01, 2021.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo4\/nemo4-arc2-01\/"}},"id":"https:\/\/cbull.info\/nemo4\/nemo4-arc2-01","published":"2021-02-08T00:30:00+00:00","updated":"2021-02-08T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">We take the first step of downloading, compiling and testing NEMO4 code on ARCHER2.<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li><a href=\"http:\/\/www.archer.ac.uk\/access\/\">ARCHER account<\/a><\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li>\n    <p><a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/github.com\/pmathiot\/NEMOCFG\">NEMO4 ice-shelf fork Pierre Mathiot<\/a><\/p>\n  <\/li>\n  <li>\n    <p><a href=\"https:\/\/pmathiot.github.io\/NEMOCFG\/docs\/build\/html\/simu_eORCA025.html#summary\">Pierre Mathiot NEMO4 docs<\/a><\/p>\n  <\/li>\n<\/ul>\n\n<h2 id=\"installing-nemo\">Installing NEMO<\/h2>\n\n<p>Get NEMO4, in my case I\u2019m using <a href=\"https:\/\/github.com\/chrisb13\/NEMOCFG\">a fork<\/a> of <a href=\"https:\/\/github.com\/pmathiot\/NEMOCFG\">Pierre\u2019s custom build<\/a>.<\/p>\n\n<blockquote>\n  <p>This uses the latest stable version as it\u2019s base, namely: NEMO4.0.4.<\/p>\n<\/blockquote>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">svn co <span class=\"nt\">-r<\/span> 13653  https:\/\/forge.ipsl.jussieu.fr\/nemo\/svn\/NEMO\/releases\/r4.0\/r4.0.4 NEMO4\n<span class=\"c\">#optional<\/span>\n<span class=\"c\">#copy code from Pierre into NEMO folder, something like:<\/span>\n<span class=\"c\">#git clone git@github.com:chrisb13\/NEMOCFG.git<\/span>\n<span class=\"c\">#cd NEMOCFG<\/span>\n<span class=\"c\">#git reset --hard 7695557b1a2f67bae2ae0ab1989d878a281c1bab<\/span>\n<span class=\"c\">#rm -r \/path\/to\/NEMO4\/src<\/span>\n<span class=\"c\">#cp -r \/path\/from\/NEMOCFG\/cfgs\/eORCA025.L121-OPM006\/src \/path\/to\/NEMO4<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"build-nemo\">Build NEMO<\/h2>\n<p>Log-into ARCHER2. Based on <a href=\"https:\/\/docs.archer2.ac.uk\/research-software\/nemo\/nemo\/\">NEMO4 ARCHER2 help page<\/a>. Set-up your environment with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module <span class=\"nt\">-s<\/span> restore \/work\/n01\/shared\/acc\/n01_modules\/ucx_env<\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>From: <code class=\"language-plaintext highlighter-rouge\">\/work\/n01\/shared\/acc\/arch-X86_ARCHER2-Cray.fcm<\/code>\nput into your ARCH folder, i.e., <code class=\"language-plaintext highlighter-rouge\">\/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/arch\/arch-X86_ARCHER2-Cray.fcm<\/code><\/p>\n<\/blockquote>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%NCDF_HOME           <span class=\"nv\">$NETCDF_DIR<\/span>\n%HDF5_HOME           <span class=\"nv\">$HDF5_DIR<\/span>\n%XIOS_HOME           \/work\/n01\/shared\/acc\/xios-2.5\n\n%NCDF_INC            <span class=\"nt\">-I<\/span>%NCDF_HOME\/include <span class=\"nt\">-I<\/span>%HDF5_HOME\/include\n%NCDF_LIB            <span class=\"nt\">-L<\/span>%HDF5_HOME\/lib <span class=\"nt\">-L<\/span>%NCDF_HOME\/lib <span class=\"nt\">-lnetcdff<\/span> <span class=\"nt\">-lnetcdf<\/span> <span class=\"nt\">-lhdf5_hl<\/span> <span class=\"nt\">-lhdf5<\/span> <span class=\"nt\">-lz<\/span>\n%XIOS_INC            <span class=\"nt\">-I<\/span>%XIOS_HOME\/inc\n%XIOS_LIB            <span class=\"nt\">-L<\/span>%XIOS_HOME\/lib <span class=\"nt\">-lxios<\/span>\n\n%CPP\t             cpp\n%FC                  ftn\n%FCFLAGS             <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O1<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant\n%FFLAGS              <span class=\"nt\">-em<\/span> <span class=\"nt\">-s<\/span> integer32 <span class=\"nt\">-s<\/span> real64 <span class=\"nt\">-O1<\/span> <span class=\"nt\">-hflex_mp<\/span><span class=\"o\">=<\/span>intolerant\n%LD                  CC <span class=\"nt\">-Wl<\/span>,<span class=\"s2\">\"--allow-multiple-definition\"<\/span>\n%FPPFLAGS            <span class=\"nt\">-P<\/span> <span class=\"nt\">-traditional<\/span>\n%LDFLAGS             <span class=\"nt\">-lmpifort_cray<\/span>\n%AR                  ar\n%ARFLAGS             <span class=\"nt\">-r<\/span>\n%MK                  gmake\n%USER_INC            %XIOS_INC %NCDF_INC\n%USER_LIB            %XIOS_LIB %NCDF_LIB\n\n%CC                  cc\n%CFLAGS              <span class=\"nt\">-O0<\/span><\/code><\/pre><\/figure>\n\n<p>Add <code class=\"language-plaintext highlighter-rouge\">-J<\/code> flag to <code class=\"language-plaintext highlighter-rouge\">FC_MODSEARCH<\/code> in <code class=\"language-plaintext highlighter-rouge\">\/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/ext\/FCM\/lib\/Fcm\/Config.pm<\/code>, should look like<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">FC_MODSEARCH <span class=\"o\">=&gt;<\/span> <span class=\"s1\">'-J'<\/span>,                <span class=\"c\"># FC flag, specify \"module\" path<\/span><\/code><\/pre><\/figure>\n\n<p>Add <code class=\"language-plaintext highlighter-rouge\">key_nosignedzero<\/code> to <code class=\"language-plaintext highlighter-rouge\">\/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/tests\/ISOMIPY\/cpp_ISOMIPY.fcm<\/code>, should have:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">chbull@uan01:\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/tests\/ISOMIPY&gt; <span class=\"nb\">cat <\/span>cpp_ISOMIPY.fcm \n bld::tool::fppkeys   key_iomput key_mpp_mpi key_nosignedzero<\/code><\/pre><\/figure>\n\n<p>Test compile works, i.e.,<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\n.\/makenemo <span class=\"nt\">-n<\/span> <span class=\"s1\">'ISOMIPY'<\/span> <span class=\"nt\">-a<\/span> <span class=\"s1\">'ISOMIP'<\/span> <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray <span class=\"nt\">-j<\/span> 16\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-lah<\/span> tests\/ISOMIPY\/BLD\/bin\/nemo.exe\n<span class=\"c\"># beer time ?<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"run-nemo\">Run NEMO<\/h2>\n\n<p>We use Andrew\u2019s script to create a template for a run file.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">chbull@uan01:\/work\/n01\/shared\/acc&gt; .\/mkslurm <span class=\"nt\">-S<\/span> 0 <span class=\"nt\">-s<\/span> 0 <span class=\"nt\">-C<\/span> 24\nRunning: mkslurm <span class=\"nt\">-S<\/span> 0 <span class=\"nt\">-s<\/span> 0 <span class=\"nt\">-m<\/span>  2 <span class=\"nt\">-C<\/span>  24 <span class=\"nt\">-c<\/span>  2 <span class=\"nt\">-t<\/span> 00:10:00 <span class=\"nt\">-a<\/span> n01 <span class=\"nt\">-j<\/span> nemo_test\n<span class=\"nb\">.<\/span>\n.<\/code><\/pre><\/figure>\n\n<p>With a few trivial changes (saving to something like \/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/tests\/ISOMIPY\/EXP00\/runnemo.sh; which will make sense in a moment)..<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#!\/bin\/bash<\/span>\n<span class=\"c\">#SBATCH --job-name=nemo_test<\/span>\n<span class=\"c\">#SBATCH --time=00:10:00<\/span>\n<span class=\"c\">#SBATCH --nodes=1<\/span>\n<span class=\"c\">#SBATCH --ntasks=24<\/span>\n<span class=\"c\">#SBATCH --account=n02<\/span>\n<span class=\"c\">#SBATCH --partition=standard<\/span>\n<span class=\"c\">#SBATCH --qos=short<\/span>\n<span class=\"c\"># Created by: mkslurm -S 0 -s 0 -m 2 -C  24 -c  2 -t 00:10:00 -a n01 -j nemo_test<\/span>\nmodule <span class=\"nt\">-s<\/span> restore \/work\/n01\/shared\/acc\/n01_modules\/ucx_env\n<span class=\"nb\">export <\/span><span class=\"nv\">OMP_NUM_THREADS<\/span><span class=\"o\">=<\/span>1\n<span class=\"c\">#<\/span>\n<span class=\"nb\">cat<\/span> <span class=\"o\">&gt;<\/span> myscript_wrapper2.sh <span class=\"o\">&lt;&lt;<\/span> <span class=\"no\">EOFB<\/span><span class=\"sh\">\n#!\/bin\/ksh\n#\nset -A map .\/xios_server.exe .\/nemo\nexec_map=( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 )\n#\nexec <\/span><span class=\"se\">\\$<\/span><span class=\"sh\">{map[<\/span><span class=\"se\">\\$<\/span><span class=\"sh\">{exec_map[<\/span><span class=\"se\">\\$<\/span><span class=\"sh\">SLURM_PROCID]}]} \n##\n<\/span><span class=\"no\">EOFB\n<\/span><span class=\"nb\">chmod <\/span>u+x .\/myscript_wrapper2.sh\n<span class=\"c\">#<\/span>\nsrun <span class=\"nt\">--mem-bind<\/span><span class=\"o\">=<\/span><span class=\"nb\">local<\/span> <span class=\"nt\">--cpu-bind<\/span><span class=\"o\">=<\/span>v,map_cpu:00,0x2,0x4,0x6,0x8,0xa,0xc,0xe,0x10,0x12,0x14,0x16,0x18,0x1a,0x1c,0x1e,0x20,0x22,0x24,0x26,0x28,0x2a,0x2c,0x2e, .\/myscript_wrapper2.sh<\/code><\/pre><\/figure>\n\n<p>Submit with<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/tests\/ISOMIPY\/EXP00\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/work\/n01\/shared\/acc\/xios-2.5 xios_server.exe\nsbatch <span class=\"nt\">--reservation<\/span><span class=\"o\">=<\/span>shortqos \/lus\/cls01095\/work\/n02\/n02\/chbull\/nemo\/models\/NEMO4\/tests\/ISOMIPY\/EXP00\/runnemo.sh\n<span class=\"c\"># second beer ?<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"build-nemo-tools\">Build NEMO tools<\/h2>\n<p>Compile REBUILD_NEMO (used to recombine outputs at the end of the jobs \u2013 see NEMO4\/tools\/REBUILD_NEMO\/README.rst) and DOMAINcfg.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd <\/span>NEMO4\/tools\/\n.\/maketools <span class=\"nt\">-h<\/span> \n.\/maketools <span class=\"nt\">-n<\/span> REBUILD_NEMO <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray\n.\/maketools <span class=\"nt\">-n<\/span> DOMAINcfg <span class=\"nt\">-m<\/span> X86_ARCHER2-Cray\n<span class=\"c\"># to check that everything went fine<\/span>\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-lah<\/span> REBUILD_NEMO\/BLD\/bin\/rebuild_nemo.exe\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-lah<\/span> DOMAINcfg\/BLD\/bin\/make_domain_cfg.exe<\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/nemo4\/nemo4-arc2-01\/\">Building and Running NEMO4 on ARCHER2.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on February 08, 2021.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo\/nemo-wed12-05\/"}},"id":"https:\/\/cbull.info\/nemo\/nemo-wed12-05","published":"2018-05-21T10:30:00+00:00","updated":"2018-05-21T10:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">Building the initial state and forcing fields for WED12.<\/p>\n<!--bash_example-->\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li><a href=\"https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO\">ARCHER fork of Nicolas Jourdain GitHub repository for WED12 configuration, this guide is based on these notes<\/a><\/li>\n<\/ul>\n\n<p>Build the bathymetry (and ice shelf draft if needed) and coordinates files for the regional domain.\nGo to your repo, and update the following file for your machine: <code class=\"language-plaintext highlighter-rouge\">vi BUILD_CONFIG_NEMO\/submit.sh<\/code> (in the ARCHER case this was unnecessary).<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/extract_bathy_coord   <span class=\"c\">## -&gt; should create the bathy and coordinate files,<\/span>\n                        <span class=\"c\">##    e.g. bathy_meter_WED12.nc and coordinates_WED12.nc<\/span>\n                        <span class=\"c\">##    (stored in directory defined as config_dir in the namelist)<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"build-the-mesh-mask\">Build the mesh mask<\/h2>\n<blockquote>\n  <p>Prerequisite: successful compile of NEMO (see Step 3).<\/p>\n<\/blockquote>\n\n<p>Create mesh_mask file.<\/p>\n\n<p>To do this, you need to run nemo.exe to calculate the exact mesh and mask. Run nemo with nn_msh = 1 in the namelist. No need to have all the input files here, just: xios_files, namelists, coordinates.nc, isf_draft_meter.nc and bathy_meter.nc. It will crash shortly after creating mesh_mask.nc. Details:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">mkdir<\/span> <span class=\"nt\">-p<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12\n<span class=\"nb\">cd<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12\/coordinates_WED12.nc coordinates.nc\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12\/bathy_meter_WED12.nc bathy_meter.nc\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12\/bathy_meter_WED12.nc isf_draft_meter.nc \n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/XIOS\/bin\/xios_server.exe xios_server.exe\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/WED12\/BLD\/bin\/nemo.exe nemo.exe\n<span class=\"c\">#cp namelist_ref AND namelist_cfg into create_mesh_mask_wed12 folder<\/span>\n<span class=\"c\">#cp namelist_ice_ref AND namelist_ice_cfg into create_mesh_mask_wed12 folder<\/span>\n\n<span class=\"c\">#grab any xios2 files just so the model will start, e.g.<\/span>\n<span class=\"nb\">cp<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/GYRE_XIOS\/EXP00\/iodef.xml \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12_two\/\n<span class=\"nb\">cp<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/SHARED\/field_def.xml \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12_two\/\n<span class=\"nb\">cp<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/GYRE_XIOS\/EXP00\/file_def.xml \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12_two\/\n<span class=\"nb\">cp<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/GYRE_XIOS\/EXP00\/domain_def.xml \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12_two\/\n\n<span class=\"c\">## NB: set jpni=jpnj=jpnij=0 in the &amp;nammpp section of NEMO's namelist.<\/span>\n<span class=\"c\">##     and use the same &amp;namdom parameters as in the simulation used as BDYs.<\/span>\nqsub run_nemo.sh    <span class=\"c\">## this will create mesh_mask_${CONFIG}.nc before crashing<\/span><\/code><\/pre><\/figure>\n\n<p>In my ARCHER case the <code class=\"language-plaintext highlighter-rouge\">run_nemo.sh<\/code> file looks like:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#!\/bin\/bash <\/span>\n<span class=\"c\">#!<\/span>\n<span class=\"c\">#PBS -N PC-eos80<\/span>\n<span class=\"c\">#PBS -l walltime=1:00:00<\/span>\n<span class=\"c\">#PBS -l select=1<\/span>\n<span class=\"c\">#PBS -j oe<\/span>\n<span class=\"c\">#PBS -A n02-bas<\/span>\n\n<span class=\"nb\">export <\/span><span class=\"nv\">PBS_O_WORKDIR<\/span><span class=\"o\">=<\/span><span class=\"si\">$(<\/span><span class=\"nb\">readlink<\/span> <span class=\"nt\">-f<\/span> <span class=\"nv\">$PBS_O_WORKDIR<\/span><span class=\"si\">)<\/span>               \n<span class=\"nb\">export <\/span><span class=\"nv\">OMP_NUM_THREADS<\/span><span class=\"o\">=<\/span>1\n<span class=\"nb\">cd<\/span> <span class=\"nv\">$PBS_O_WORKDIR<\/span>\n\naprun <span class=\"nt\">-n<\/span> 2 .\/nemo.exe\naprun <span class=\"nt\">-n<\/span> 2 .\/xios_server.exe<\/code><\/pre><\/figure>\n\n<p>This should result in mesh_mask_0000.nc and mesh_mask_0001.nc out of this (check that mbathy, misf, isfdraft look sensible). We now need to stick them back together\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/run\/create_mesh_mask_wed12\n<span class=\"c\">#From BUILD_CONFIG_NEMO, make sure NEMOdir is correct<\/span>\n.\/rebuild_mesh_mask.sh \n<span class=\"nb\">mv <\/span>mesh_mask.nc <span class=\"nv\">$WORKDIR<\/span>\/input\/nemo_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\/mesh_mask_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>.nc <span class=\"c\">## directory defined as config_dir<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"create-the-inital-state\">Create the inital state<\/h2>\n\n<p>Create the initial state (temperature and salinity)<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/extract_istate            <span class=\"c\">## -&gt; should create the initial state for temperature and salinity<\/span>\n                            <span class=\"c\">##    e.g. dta_temp_WED12.nc and dta_sal_WED12.nc<\/span>\n                            <span class=\"c\">##    (stored in directory defined as config_dir in the namelist)<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"ocean-forcing-files\">Ocean forcing files<\/h2>\n<p>Create the lateral boundary conditions (u, v, T, S, SSH, sea-ice thic, sea-ice frac)<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/build_coordinates_bdy       <span class=\"c\">## -&gt; creates the coordinate file for lateral boundaries<\/span>\n                              <span class=\"c\">##    e.g. coordinates_bdy_WED12.nc<\/span>\n\n.\/extract_bdy_gridT           <span class=\"c\">## -&gt; creates T,S bdy files and store them in a BDY folder<\/span>\n                              <span class=\"c\">##    itself located in directory defined as config_dir<\/span>\n\n.\/extract_bdy_gridU           <span class=\"c\">## -&gt; creates U   bdy files and store them in a BDY folder<\/span>\n.\/extract_bdy_gridV           <span class=\"c\">## -&gt; creates V   bdy files and store them in a BDY folder<\/span>\n.\/extract_bdy_icemod          <span class=\"c\">## -&gt; creates ice bdy files and store them in a BDY folder<\/span>\n.\/extract_bdy_ssh             <span class=\"c\">## -&gt; creates SSH bdy files and store them in a BDY folder<\/span>\n\n.\/concatenate_yearly_BDY.sh   <span class=\"c\">## Edit this file first.<\/span>\n                              <span class=\"c\">## -&gt; concatenate the bdy files into yearly files<\/span>\n\n.\/extract_bdy_tides           <span class=\"c\">## if you want to put tidal signals along the BDYs<\/span><\/code><\/pre><\/figure>\n\n<h3 id=\"interpolate-cice-onto-nemo\">Interpolate CICE onto NEMO<\/h3>\n<p>If necessary, interpolate CICE onto NEMO grid before running .\/extract_bdy_icemod (above). We use CDO to do a linear interpoation. Here\u2019s an example:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#hack up a griddes file so the source file looks more like the target..<\/span>\ncdo griddes mi-an854o_1m_19960101_20050130_01_grid_T_toy.nc <span class=\"o\">&gt;<\/span> new_grid.txt\ncdo griddes mi-an854i.1m.1995-01_small_toy.nc <span class=\"o\">&gt;<\/span> old_grid.txt\n\n<span class=\"c\">#xname\/yname as nav_lon\/nav_lat (the latter seems to be important to match the target x\/y names)<\/span>\n<span class=\"nb\">sed<\/span> <span class=\"nt\">-i<\/span> <span class=\"nt\">-e<\/span> <span class=\"s1\">'s\/TLON\/nav_lon\/g'<\/span> old_grid.txt\n<span class=\"nb\">sed<\/span> <span class=\"nt\">-i<\/span> <span class=\"nt\">-e<\/span> <span class=\"s1\">'s\/TLAT\/nav_lat\/g'<\/span> old_grid.txt\n\n<span class=\"c\">#remove area from new_grid.txt, the following will help find it.<\/span>\n<span class=\"c\">#grep \u2013n \u201c[a-d][f-z] new_grid.txt <\/span>\n\n<span class=\"c\">#re-write with hacked grid defn<\/span>\ncdo setgrid,old_grid.txt <span class=\"nt\">-select<\/span>,name<span class=\"o\">=<\/span>aice,hi,hs ..\/mi-an854i.1m.1995-01.nc .\/mi-an854i.1m.1995-01_small_newgriddefn.nc\n\n<span class=\"c\">#Re-mapping, creating the weights first.. <\/span>\ncdo gennn,new_grid.txt mi-an854i.1m.1995-01_small_newgriddefn.nc weights.nc\ncdo remap,new_grid.txt,weights.nc mi-an854i.1m.1995-01_small_newgriddefn.nc mi-an854i.1m.1995-01_small_newgriddefn_remapnn_two.nc\n\n<span class=\"c\">#copy interpolated data to a G07 file and match LIM variable names according to BUILD_CONFIG_NEMO\/src\/extract_bdy_icemod.f90<\/span><\/code><\/pre><\/figure>\n\n<!--See nemo_wed_analysis\/configs\/wed12\/fix_lim_icemod.py for last step-->\n\n<p>Other files (SSS for restoring, runoff, chlorophyll)<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/extract_SSS_restoring       <span class=\"c\">## -&gt; creates SSS files and store them in a SSS folder<\/span>\n.\/concatenate_yearly_SSS.sh   <span class=\"c\">## Edit this file first.<\/span>\n                              <span class=\"c\">## -&gt; concatenate the bdy files into yearly files<\/span>\n\n.\/extract_runoff_icebergs     <span class=\"c\">## -&gt; creates iceberg runoff file<\/span>\n                              <span class=\"c\">##    (stored in config_dir defined in the namelist)<\/span>\n\n.\/extract_chloro              <span class=\"c\">## -&gt; creates chlorophyll file<\/span>\n                              <span class=\"c\">##    (stored in config_dir defined in the namelist)<\/span><\/code><\/pre><\/figure>\n\n<h2 id=\"atmospheric-forcing-files\">Atmospheric forcing files<\/h2>\n<p>Weights for the interpolation of atmospheric forcing<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\"># here it is assumed that you have NEMO downloaded and installed as explained in step #1<\/span>\n<span class=\"nb\">cd<\/span> <span class=\"nv\">$WORKDIR<\/span>\/models\/MY_NEMO\/NEMOGCM\/TOOLS\nmaketools <span class=\"nt\">-m<\/span> XC_ARCHER_INTEL <span class=\"nt\">-n<\/span> WEIGHTS           <span class=\"c\">## Adapt for any machine different from ARCHER (try makenemo -h)<\/span>\n<span class=\"nb\">cd <\/span>WEIGHTS                                <span class=\"c\">## See nice README file in this directoy.<\/span>\n<span class=\"nb\">cp<\/span> <span class=\"nt\">-p<\/span> nocsutil\/namelist_example_bilin namelist_WEIGHTS_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>_bilin <span class=\"c\">## Edit this namelist<\/span><\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>NB: you may have to increase char_len in src\/kinds_mod.f90 if you include long path for file names.<\/p>\n<\/blockquote>\n\n<p>Below is an example for <code class=\"language-plaintext highlighter-rouge\">namelist_WEIGHTS_${CONFIG}_bilin<\/code>:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">&amp;grid_inputs\n    input_file <span class=\"o\">=<\/span> <span class=\"s1\">'drowned_precip_DFS5.2_y1993.nc'<\/span>\n    nemo_file <span class=\"o\">=<\/span> <span class=\"s1\">'coordinates_WED12.nc'<\/span>\n    datagrid_file <span class=\"o\">=<\/span> <span class=\"s1\">'remap_data_grid.nc'<\/span>\n    nemogrid_file <span class=\"o\">=<\/span> <span class=\"s1\">'remap_nemo_grid.nc'<\/span>\n    method <span class=\"o\">=<\/span> <span class=\"s1\">'regular'<\/span>\n    input_lon <span class=\"o\">=<\/span> <span class=\"s1\">'LON'<\/span>\n    input_lat <span class=\"o\">=<\/span> <span class=\"s1\">'LAT'<\/span>\n    nemo_lon <span class=\"o\">=<\/span> <span class=\"s1\">'glamt'<\/span>\n    nemo_lat <span class=\"o\">=<\/span> <span class=\"s1\">'gphit'<\/span>\n    nemo_mask <span class=\"o\">=<\/span> <span class=\"s1\">'none'<\/span>\n    nemo_mask_value <span class=\"o\">=<\/span> 10\n    input_mask <span class=\"o\">=<\/span> <span class=\"s1\">'none'<\/span>\n    input_mask_value <span class=\"o\">=<\/span> 10\n\/\n\n&amp;remap_inputs\n    num_maps <span class=\"o\">=<\/span> 1\n    grid1_file <span class=\"o\">=<\/span> <span class=\"s1\">'remap_data_grid.nc'<\/span>\n    grid2_file <span class=\"o\">=<\/span> <span class=\"s1\">'remap_nemo_grid.nc'<\/span>\n    interp_file1 <span class=\"o\">=<\/span> <span class=\"s1\">'data_nemo_bilin.nc'<\/span>\n    interp_file2 <span class=\"o\">=<\/span> <span class=\"s1\">'nemo_data_bilin.nc'<\/span>\n    map1_name <span class=\"o\">=<\/span> <span class=\"s1\">'data to nemo bilin Mapping'<\/span>\n    map2_name <span class=\"o\">=<\/span> <span class=\"s1\">'nemo to data bilin Mapping'<\/span>\n    map_method <span class=\"o\">=<\/span> <span class=\"s1\">'bilinear'<\/span>\n    normalize_opt <span class=\"o\">=<\/span> <span class=\"s1\">'frac'<\/span>\n    output_opt <span class=\"o\">=<\/span> <span class=\"s1\">'scrip'<\/span>\n    restrict_type <span class=\"o\">=<\/span> <span class=\"s1\">'latitude'<\/span>\n    num_srch_bins <span class=\"o\">=<\/span> 90\n    luse_grid1_area <span class=\"o\">=<\/span> .false.\n    luse_grid2_area <span class=\"o\">=<\/span> .false.\n\/\n\n&amp;interp_inputs\n    input_file <span class=\"o\">=<\/span> <span class=\"s2\">\"drowned_precip_DFS5.2_y1993.nc\"<\/span>\n    interp_file <span class=\"o\">=<\/span> <span class=\"s2\">\"data_nemo_bilin.nc\"<\/span>\n    input_name <span class=\"o\">=<\/span> <span class=\"s2\">\"snow\"<\/span>\n    input_start <span class=\"o\">=<\/span> 1,1,1,1\n    input_stride <span class=\"o\">=<\/span> 1,1,1,1\n    input_stop <span class=\"o\">=<\/span> 0,0,0,1\n    input_vars <span class=\"o\">=<\/span> <span class=\"s1\">'initial_time0_hours'<\/span>\n\/\n\n&amp;interp_outputs\n    output_file <span class=\"o\">=<\/span> <span class=\"s2\">\"snow_orca.nc\"<\/span>\n    output_mode <span class=\"o\">=<\/span> <span class=\"s2\">\"create\"<\/span>\n    output_dims <span class=\"o\">=<\/span> <span class=\"s1\">'x'<\/span>, <span class=\"s1\">'y'<\/span>, <span class=\"s1\">'time_counter'<\/span>\n    output_scaling <span class=\"o\">=<\/span> <span class=\"s2\">\"snow|1.0\"<\/span>, <span class=\"s2\">\"time_counter|86400.0\"<\/span>\n    output_name <span class=\"o\">=<\/span> <span class=\"s1\">'snow'<\/span>\n    output_lon <span class=\"o\">=<\/span> <span class=\"s1\">'x'<\/span>\n    output_lat <span class=\"o\">=<\/span> <span class=\"s1\">'y'<\/span>\n    output_vars <span class=\"o\">=<\/span> <span class=\"s1\">'time_counter'<\/span>\n    output_attributes <span class=\"o\">=<\/span> <span class=\"s1\">'time_counter|units|seconds since 1995-00-00 00:00:00'<\/span>,\n                        <span class=\"s1\">'time_counter|calendar|noleap'<\/span>,\n                        <span class=\"s1\">'snow|units|mm\/s'<\/span>\n\/<\/code><\/pre><\/figure>\n\n<p>Then, execute these things:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#create links to relevant input files<\/span>\n<span class=\"c\">#coordinates_WED12.nc -&gt; \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12\/coordinates_WED12.nc<\/span>\n<span class=\"c\">#drowned_precip_DFS5.2_y1993.nc -&gt; \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12_mathiot_eORCA025-GO7\/precip_core_y1978.nc<\/span>\n<span class=\"c\">#snow_orca.nc -&gt; \/fs2\/n02\/n02\/chbull\/nemo\/bld_configs\/input_WED12_mathiot_eORCA025-GO7\/snow_core_y1970.nc<\/span>\n\n.\/scripgrid.exe   <span class=\"c\">## namelist_${CONFIG}_bilin<\/span>\n.\/scrip.exe       <span class=\"c\">## namelist_${CONFIG}_bilin<\/span>\n.\/scripshape.exe  <span class=\"c\">## namelist_${CONFIG}_bilin<\/span><\/code><\/pre><\/figure>\n\n<p>Then create another namelist:  <code class=\"language-plaintext highlighter-rouge\">namelist_${CONFIG}_bicub<\/code> and just change these parameters:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">interp_file1 <span class=\"o\">=<\/span> <span class=\"s1\">'data_nemo_bicubic.nc'<\/span>\ninterp_file2 <span class=\"o\">=<\/span> <span class=\"s1\">'nemo_data_bicubic.nc'<\/span>\nmap1_name <span class=\"o\">=<\/span> <span class=\"s1\">'data to nemo bicubic Mapping'<\/span>\nmap2_name <span class=\"o\">=<\/span> <span class=\"s1\">'nemo to data bicubic Mapping'<\/span>\nmap_method <span class=\"o\">=<\/span> <span class=\"s1\">'bicubic'<\/span>\ninterp_file <span class=\"o\">=<\/span> <span class=\"s1\">'data_nemo_bicubic.nc'<\/span>\noutput_file <span class=\"o\">=<\/span> <span class=\"s1\">'weights_bicubic.nc'<\/span><\/code><\/pre><\/figure>\n\n<p>Then execute :<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/scrip.exe       <span class=\"c\">## namelist_${CONFIG}_bicub<\/span>\n.\/scripshape.exe  <span class=\"c\">## namelist_${CONFIG}_bicub<\/span><\/code><\/pre><\/figure>\n\n<p>At the end of this, you should have: <code class=\"language-plaintext highlighter-rouge\">weights_bicubic.nc<\/code> and <code class=\"language-plaintext highlighter-rouge\">weights_bilin.nc<\/code>.<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-05\/\">Build the inital state and forcing fields for  WED12 (Step 5)<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on May 21, 2018.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo\/nemo-wed12-04\/"}},"id":"https:\/\/cbull.info\/nemo\/nemo-wed12-04","published":"2018-05-21T08:30:00+00:00","updated":"2018-05-21T08:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">Building the pre-processing tools<\/p>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li><a href=\"https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO\">ARCHER fork of Nicolas Jourdain GitHub repository for WED12 configuration, this guide is almost verbatim based on these notes<\/a><\/li>\n<\/ul>\n\n<h2 id=\"prepare-the-pre-processing-tools-gsw-toolbox-and-nicos-regional-tools\">Prepare the pre-processing tools (GSW TOOLBOX and Nico\u2019s regional tools):<\/h2>\n\n<p>First you may need the TEOS10 toolbox to convert from EOS80 to TEOS10. To avoid issues with updates on the GSW-Fortran tools, Nico has cloned the 2016 GSW-Fortran in this repository:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">git clone https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO.git\n<span class=\"nb\">cd <\/span>GSW-Fortran\/test\nvi makefile   <span class=\"c\">#in particular fill the FC and NETCDF_INCDIR variables<\/span>\nmake\n.\/gsw_check   <span class=\"c\"># to check (some have to work, maybe not all of them)<\/span>\n<span class=\"nb\">cd<\/span> ..\/..<\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>NB: In case you want to check for updates (not recommended), you can still do:\n git clone https:\/\/github.com\/TEOS-10\/GSW-Fortran.git<\/p>\n<\/blockquote>\n\n<p>The gsw_data_v3_0.nc file provided in this repository should be fine, but in case you start again from the original file (i.e. from github.com\/TEOS-10\/GSW-Fortran.git), you will need to modify it\nto avoid NaN in some places (otherwise, skip the next 4 lines):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">.\/compile.sh remove_NaN_from_gsw_data_v3_0.f90\n.\/remove_NaN_from_gsw_data_v3_0\nncks <span class=\"nt\">-x<\/span> <span class=\"nt\">-v<\/span> ocean_ref,ndepth_ref,deltaSA_ref,SA_ref,SAAR_ref GSW-Fortran\/test\/gsw_data_v3_0.nc gsw_data_v3_0.nc\nncks <span class=\"nt\">-A<\/span> gsw_data_v3_0_to_be_ncks-A.nc gsw_data_v3_0.nc<\/code><\/pre><\/figure>\n\n<p>Back in root of BUILD_CONFIG_NEMO.git. Edit your own namelist, e.g. namelist_WED12, and link namelist_pre to it:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">vi namelist_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\n<span class=\"nb\">ln<\/span> <span class=\"nt\">-s<\/span> <span class=\"nt\">-v<\/span> namelist_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span> namelist_pre  <span class=\"c\"># in BUILD_CONFIG_NEMO dir<\/span><\/code><\/pre><\/figure>\n\n<p>Edit <code class=\"language-plaintext highlighter-rouge\">compile_ALL.sh<\/code>, adapt fortran compiler (and maybe netcdf path), then execute it: <code class=\"language-plaintext highlighter-rouge\">.\/compile_ALL.sh<\/code>. Create a directory where you will store all the netcdf files created along the following steps, e.g.:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">mkdir<\/span> <span class=\"nv\">$WORKDIR<\/span>\/input\/nemo_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>  <span class=\"c\"># WARNING: this must correspond to the namelist entry \"config_dir\"<\/span><\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-04\/\">Pre-processing tools for WED12 (Step 4)<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on May 21, 2018.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo\/nemo-wed12-03\/"}},"id":"https:\/\/cbull.info\/nemo\/nemo-wed12-03","published":"2018-05-18T08:30:00+00:00","updated":"2018-05-18T08:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">Starting the WED12 configuration (compiling NEMO and NEMO\u2019s maketools)<\/p>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li><a href=\"https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO\">ARCHER fork of Nicolas Jourdain GitHub repository for WED12 configuration, this guide is based on these notes<\/a><\/li>\n<\/ul>\n\n<h2 id=\"create-wed12-configuration\">Create WED12 configuration<\/h2>\n\n<p>First of all, choose a configuration name, e.g. WED12, AMU12, PERIANT025, etc, and save it, i.e.: <code class=\"language-plaintext highlighter-rouge\">export CONFIG='WED12'<\/code><\/p>\n\n<p>Compile for a new configuration, e.g. the WED12 configuration (you can have several ones)<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd <\/span>MY_NEMO\/NEMOGCM\/CONFIG\n<span class=\"nb\">echo<\/span> <span class=\"s2\">\"<\/span><span class=\"nv\">$CONFIG<\/span><span class=\"s2\"> OPA_SRC LIM_SRC_3\"<\/span> <span class=\"o\">&gt;&gt;<\/span> cfg.txt  <span class=\"c\">## here for OPA+LIM3 (see cfg.txt for other options)<\/span>\n<span class=\"nb\">mkdir<\/span> <span class=\"nv\">$CONFIG<\/span><\/code><\/pre><\/figure>\n\n<p>Choose fppkeys prior to compilation (see NEMO documentations or examples in existing configurations, e.g. <code class=\"language-plaintext highlighter-rouge\">MY_NEMO\/NEMOGCM\/CONFIG\/AMM12\/cpp_AMM12.fcm<\/code>), and compile, e.g. :<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd<\/span> \/NEMOGCM\/CONFIG\n<span class=\"nb\">echo<\/span> <span class=\"s2\">\" bld::tool::fppkeys key_dynldf_c2d key_dynspg_flt key_iomput  key_ldfslp  key_tide key_lim3 key_mpp_mpi key_mpp_rep key_nosignedzero key_trabbl key_traldf_c2d key_vvl key_xios2  key_zdfddm key_zdftke key_zdftmx \"<\/span> <span class=\"o\">&gt;<\/span> <span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\/cpp_<span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>.fcm\n<span class=\"nb\">time<\/span> .\/makenemo <span class=\"nt\">-n<\/span> <span class=\"nv\">$CONFIG<\/span> <span class=\"nt\">-m<\/span> XC_ARCHER_INTEL <span class=\"nt\">-j<\/span> 8 &amp;&gt; compile.log &amp;\n<span class=\"nb\">tail<\/span> <span class=\"nt\">-f<\/span> compile.log            <span class=\"c\">## to follow the compilation<\/span>\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-al<\/span> <span class=\"k\">${<\/span><span class=\"nv\">CONFIG<\/span><span class=\"k\">}<\/span>\/BLD\/bin\/nemo.exe  <span class=\"c\">## to check that everything went fine<\/span><\/code><\/pre><\/figure>\n\n<blockquote>\n  <p>NB: if you recompile, it is recommended to remove these directories: <code class=\"language-plaintext highlighter-rouge\">rm -rf ${CONFIG}\/WORK ${CONFIG}\/BLD;cd ..<\/code><\/p>\n<\/blockquote>\n\n<h2 id=\"nemo-maketools\">NEMO maketools<\/h2>\n\n<p>Compile REBUILD_NEMO (used to recombine outputs at the end of the jobs):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd <\/span>TOOLS\n.\/maketools <span class=\"nt\">-h<\/span>  <span class=\"c\">## use same architecture as for NEMO's compilation (e.g. XC_ARCHER_INTEL)<\/span>\n.\/maketools <span class=\"nt\">-m<\/span> XC_ARCHER_INTEL <span class=\"nt\">-n<\/span> REBUILD_NEMO\n<span class=\"nb\">ls<\/span> <span class=\"nt\">-al<\/span> REBUILD_NEMO\/BLD\/bin\/  <span class=\"c\">## to check that everything went fine<\/span>\n<span class=\"nb\">cd<\/span> ..<\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-03\/\">Building WED12 (Step 3)<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on May 18, 2018.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo\/nemo-wed12-02\/"}},"id":"https:\/\/cbull.info\/nemo\/nemo-wed12-02","published":"2018-05-18T00:30:00+00:00","updated":"2018-05-18T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">Running an idealised test case configuration with NEMO<\/p>\n\n<h2 id=\"testing-nemo\">Testing NEMO<\/h2>\n\n<p>We will now test NEMO by running a double gyre test case. <code class=\"language-plaintext highlighter-rouge\">cd<\/code> into <code class=\"language-plaintext highlighter-rouge\">NEMOGCM\/CONFIG<\/code> and run <code class=\"language-plaintext highlighter-rouge\">.\/makenemo -n GYRE_XIOS -m XC_ARCHER_INTEL -j 8<\/code> (took 121 seconds).<\/p>\n\n<p>If you have loaded netCDF, HDF5 and installed XIOS correctly this should work. Go into <code class=\"language-plaintext highlighter-rouge\">NEMOGCM\/CONFIG\/GYRE_XIOS\/EXP00<\/code>. Make a link to XIOS by:\n<code class=\"language-plaintext highlighter-rouge\">ln -sf \/path\/to\/xios\/bin\/xios_server.exe xios_server.exe<\/code><\/p>\n\n<!--Then open the iodef.xml file and find the first line looking like-->\n<!--`<file_definition type=\"multiple_file\" name=\"@expname@_@freq@_@startdate@_@enddate@\" sync_freq=\"1ts\" min_digits=\"4\">`-->\n<!--Change \"multiple_file\" to \"one_file\". -->\n\n<p>This particular branch needs the following namelist tweak (<code class=\"language-plaintext highlighter-rouge\">\/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/CONFIG\/GYRE_XIOS\/EXP00\/namelist_cfg<\/code>):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">&amp;nameos        <span class=\"o\">!<\/span>   ocean physical parameters\n<span class=\"o\">!<\/span><span class=\"nt\">-----------------------------------------------------------------------<\/span>\n   nn_eos      <span class=\"o\">=<\/span>   0       <span class=\"o\">!<\/span>  <span class=\"nb\">type <\/span>of equation of state and Brunt-Vaisala frequency\n   ln_useCT    <span class=\"o\">=<\/span> .false.   <span class=\"o\">!<\/span> use of Conservative Temp. <span class=\"o\">==&gt;<\/span> surface CT converted <span class=\"k\">in <\/span>Pot. Temp. <span class=\"k\">in <\/span>sbcssm<\/code><\/pre><\/figure>\n\n<p>Make a runscript named \u201crun_gyre.pbs\u201d like this:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#!\/bin\/bash <\/span>\n<span class=\"c\">#!<\/span>\n<span class=\"c\">#PBS -N PC-eos80<\/span>\n<span class=\"c\">#PBS -l walltime=1:00:00<\/span>\n<span class=\"c\">#PBS -l select=7<\/span>\n<span class=\"c\">#PBS -j oe<\/span>\n<span class=\"c\">#PBS -A n02-bas<\/span>\n\n  <span class=\"nb\">export <\/span><span class=\"nv\">PBS_O_WORKDIR<\/span><span class=\"o\">=<\/span><span class=\"si\">$(<\/span><span class=\"nb\">readlink<\/span> <span class=\"nt\">-f<\/span> <span class=\"nv\">$PBS_O_WORKDIR<\/span><span class=\"si\">)<\/span>               \n  <span class=\"nb\">export <\/span><span class=\"nv\">OMP_NUM_THREADS<\/span><span class=\"o\">=<\/span>1\n  <span class=\"nb\">cd<\/span> <span class=\"nv\">$PBS_O_WORKDIR<\/span>\n\n  <span class=\"nb\">echo<\/span> <span class=\"s2\">\" \"<\/span><span class=\"p\">;<\/span>\n  <span class=\"nv\">OCEANCORES<\/span><span class=\"o\">=<\/span>144\n  <span class=\"nv\">XIOCORES<\/span><span class=\"o\">=<\/span>3\n<span class=\"c\">###############################################################<\/span>\n\n<span class=\"nb\">ulimit<\/span> <span class=\"nt\">-c<\/span> unlimited\n<span class=\"nb\">ulimit<\/span> <span class=\"nt\">-s<\/span> unlimited\n        aprun <span class=\"nt\">-b<\/span> <span class=\"nt\">-n<\/span> <span class=\"nv\">$XIOCORES<\/span> <span class=\"nt\">-N<\/span> 3 .\/xios_server.exe : <span class=\"nt\">-n<\/span> <span class=\"nv\">$OCEANCORES<\/span> <span class=\"nt\">-N<\/span> 24 .\/opa<\/code><\/pre><\/figure>\n\n<p>Run\n<code class=\"language-plaintext highlighter-rouge\">qsub run_gyre.pbs<\/code><\/p>\n\n<p>NEMO will now run on 144 cores (6 nodes) and pass all output to XIOS on 3 cores (1 node) which will glue data from all processors into one file. You\u2019re output should be in:\nGYRE_5d_00010101<em>00011230_grid<\/em>*.nc<\/p>\n\n<p>(<em>Hopefully<\/em>!) congratulations, you\u2019ve just run NEMO!<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-02\/\">Testing NEMO (Step 2)<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on May 18, 2018.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/nemo\/nemo-wed12-01\/"}},"id":"https:\/\/cbull.info\/nemo\/nemo-wed12-01","published":"2018-05-17T00:30:00+00:00","updated":"2018-05-17T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">We take the first step of downloading, compiling and testing NEMO code on ARCHER<\/p>\n\n<p>Pre-requisites:<\/p>\n\n<ul>\n  <li><a href=\"http:\/\/www.archer.ac.uk\/access\/\">ARCHER account<\/a><\/li>\n  <li><a href=\"http:\/\/forge.ipsl.jussieu.fr\/nemo\/register\">NEMO repository account<\/a><\/li>\n<\/ul>\n\n<p>Suggested reading:<\/p>\n\n<ul>\n  <li><a href=\"http:\/\/forge.ipsl.jussieu.fr\/nemo\/wiki\/Users\/ModelInstall#DownloadNEMOreferencecodeandconfigurations\">NEMO reference code and configurations<\/a><\/li>\n  <li><a href=\"http:\/\/wiki.nerc-bas.ac.uk\/wiki\/index.php\/Piethi\/NEMO\/Install_NEMO\">BAS howto install NEMO guide (accessible to BAS staff only); this guide is based on these notes<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/chrisb13\/BUILD_CONFIG_NEMO\">ARCHER fork of Nicolas Jourdain GitHub repository for WED12 configuration<\/a><\/li>\n  <li><a href=\"http:\/\/forge.ipsl.jussieu.fr\/nemo\/discussion\/topic\/8\">FAQ on getting started with NEMO<\/a><\/li>\n<\/ul>\n\n<h2 id=\"installing-nemo-and-xios\">Installing NEMO and XIOS<\/h2>\n\n<p>We will first install XIOS, and then NEMO. If you haven\u2019t done so already, you\u2019ll need to load netCDF and HDF5 libraries as well as Intel compilers. On ARCHER, run:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">module load cray-netcdf-hdf5parallel\/4.4.1.1 \nmodule load cray-hdf5-parallel\/1.10.0.1\nmodule swap PrgEnv-cray PrgEnv-intel<\/code><\/pre><\/figure>\n\n<p>This worked with:<\/p>\n\n<ul>\n  <li>cray-netcdf-hdf5parallel\/4.4.1.1<\/li>\n  <li>cray-hdf5-parallel\/1.10.0.1<\/li>\n  <li>PrgEnv-intel\/5.2.82<\/li>\n<\/ul>\n\n<p>And doesn\u2019t work if you do a module purge first, ARCHER on default currently loads:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">chbull@eslogin008:~&gt; module list\nCurrently Loaded Modulefiles:\n  1<span class=\"o\">)<\/span> modules\/3.2.10.6                      12<span class=\"o\">)<\/span> gni-headers\/4.0-1.0502.10859.7.8.ari  23<span class=\"o\">)<\/span> bolt\/0.6\n  2<span class=\"o\">)<\/span> eswrap\/1.3.3-1.020200.1280.0          13<span class=\"o\">)<\/span> xpmem\/0.1-2.0502.64982.5.3.ari        24<span class=\"o\">)<\/span> nano\/2.2.6\n  3<span class=\"o\">)<\/span> switch\/1.0-1.0502.60522.1.61.ari      14<span class=\"o\">)<\/span> dvs\/2.5_0.9.0-1.0502.2188.1.116.ari   25<span class=\"o\">)<\/span> leave_time\/1.3.0\n  4<span class=\"o\">)<\/span> cce\/8.5.8                             15<span class=\"o\">)<\/span> alps\/5.2.4-2.0502.9774.31.11.ari      26<span class=\"o\">)<\/span> quickstart\/1.0\n  5<span class=\"o\">)<\/span> craype-network-aries                  16<span class=\"o\">)<\/span> rca\/1.0.0-2.0502.60530.1.62.ari       27<span class=\"o\">)<\/span> ack\/2.14\n  6<span class=\"o\">)<\/span> craype\/2.5.10                         17<span class=\"o\">)<\/span> atp\/2.1.0                             28<span class=\"o\">)<\/span> xalt\/0.6.0\n  7<span class=\"o\">)<\/span> cray-libsci\/16.11.1                   18<span class=\"o\">)<\/span> PrgEnv-cray\/5.2.82                    29<span class=\"o\">)<\/span> openssl\/1.1.0g_build1\n  8<span class=\"o\">)<\/span> udreg\/2.3.2-1.0502.10518.2.17.ari     19<span class=\"o\">)<\/span> pbs\/12.2.401.141761                   30<span class=\"o\">)<\/span> curl\/7.58.0_build1\n  9<span class=\"o\">)<\/span> ugni\/6.0-1.0502.10863.8.29.ari        20<span class=\"o\">)<\/span> craype-ivybridge                      31<span class=\"o\">)<\/span> git\/2.16.2_build1\n 10<span class=\"o\">)<\/span> pmi\/5.0.13                            21<span class=\"o\">)<\/span> cray-mpich\/7.5.5                      32<span class=\"o\">)<\/span> epcc-tools\/8.0\n 11<span class=\"o\">)<\/span> dmapp\/7.0.1-1.0502.11080.8.76.ari     22<span class=\"o\">)<\/span> packages-archer<\/code><\/pre><\/figure>\n\n<h3 id=\"xios\">XIOS<\/h3>\n\n<p>We\u2019ll do XIOS first. The recommended compiler suite for ARCHER is Cray. But as Admiral Ackbar said: \u201cIt\u2019s a trap!\u201d. You will need to use Intel!<\/p>\n\n<p>Get the latest version of XIOS (currently <a href=\"http:\/\/forge.ipsl.jussieu.fr\/nemo\/wiki\/Users\/ModelInterfacing\/InputsOutputs#ExtractingandinstallingXIOS\">XIOS 2<\/a>), which is an I\/O server to handle reading and writing data in NEMO. Source code and instructions can be found <a href=\"http:\/\/forge.ipsl.jussieu.fr\/nemo\/wiki\/Users\/ModelInterfacing\/InputsOutputs#ExtractingandinstallingXIOS\">here<\/a>.<\/p>\n\n<p>You will need the .fcm, .path, and .env files for XIOS. Get the \u201carch\u201d files for XIOS at:<\/p>\n\n<ul>\n  <li>\/work\/n02\/n02\/shared\/baspog\/arch-for-xios\/<\/li>\n<\/ul>\n\n<p>Put them in the \u201carch\u201d directory in the XIOS folder. If they are not available, they are as follows. The env file, <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/shared\/baspog\/arch-for-xios\/arch-XC30_ARCHER.env<\/code>:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">export <\/span><span class=\"nv\">HDF5_INC_DIR<\/span><span class=\"o\">=<\/span><span class=\"k\">${<\/span><span class=\"nv\">HDF5_DIR<\/span><span class=\"k\">}<\/span>\/include\n<span class=\"nb\">export <\/span><span class=\"nv\">HDF5_LIB_DIR<\/span><span class=\"o\">=<\/span><span class=\"k\">${<\/span><span class=\"nv\">HDF5_DIR<\/span><span class=\"k\">}<\/span>\/lib\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDF_INC_DIR<\/span><span class=\"o\">=<\/span><span class=\"k\">${<\/span><span class=\"nv\">NETCDF_DIR<\/span><span class=\"k\">}<\/span>\/include\n<span class=\"nb\">export <\/span><span class=\"nv\">NETCDF_LIB_DIR<\/span><span class=\"o\">=<\/span><span class=\"k\">${<\/span><span class=\"nv\">NETCDF_DIR<\/span><span class=\"k\">}<\/span>\/lib<\/code><\/pre><\/figure>\n\n<p>The fcm file, <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/shared\/baspog\/arch-for-xios\/arch-XC30_ARCHER.fcm<\/code>:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">################################################################################<\/span>\n<span class=\"c\">###################        Projet xios - xmlioserver       #####################<\/span>\n<span class=\"c\">################################################################################<\/span>\n\n%CCOMPILER      cc\n%FCOMPILER      ftn\n%LINKER         CC\n\n%BASE_CFLAGS    <span class=\"nt\">-DMPICH_SKIP_MPICXX<\/span> <span class=\"nt\">-h<\/span> msglevel_4 <span class=\"nt\">-h<\/span> zero <span class=\"nt\">-h<\/span> noparse_templates\n%PROD_CFLAGS    <span class=\"nt\">-O3<\/span> <span class=\"nt\">-DBOOST_DISABLE_ASSERTS<\/span>\n%DEV_CFLAGS     <span class=\"nt\">-g<\/span> <span class=\"nt\">-O2<\/span>\n%DEBUG_CFLAGS   <span class=\"nt\">-g<\/span>\n\n%BASE_FFLAGS    <span class=\"nt\">-warn<\/span> all <span class=\"nt\">-zero<\/span>\n%PROD_FFLAGS    <span class=\"nt\">-O3<\/span> <span class=\"nt\">-fp-model<\/span> precise <span class=\"nt\">-warn<\/span> all <span class=\"nt\">-zero<\/span>\n%DEV_FFLAGS     <span class=\"nt\">-g<\/span> <span class=\"nt\">-O2<\/span>\n%DEBUG_FFLAGS   <span class=\"nt\">-g<\/span>\n\n%BASE_INC       <span class=\"nt\">-D__NONE__<\/span>\n%BASE_LD        <span class=\"nt\">-D__NONE__<\/span>\n\n%CPP            cpp\n%FPP            cpp <span class=\"nt\">-P<\/span> <span class=\"nt\">-CC<\/span>\n%MAKE           gmake<\/code><\/pre><\/figure>\n\n<p>The \u2018path\u2019 file: <code class=\"language-plaintext highlighter-rouge\">\/work\/n02\/n02\/shared\/baspog\/arch-for-xios\/arch-XC30_ARCHER.path<\/code>:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nv\">NETCDF_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-I <\/span><span class=\"nv\">$NETCDF_INC_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">NETCDF_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s1\">'-Wl,\"--allow-multiple-definition\" -Wl,\"-Bstatic\" -L $NETCDF_LIB_DIR'<\/span>\n<span class=\"nv\">NETCDF_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-lnetcdf -lnetcdff\"<\/span>\n\n<span class=\"nv\">MPI_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">MPI_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">MPI_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n\n<span class=\"c\">#HDF5_INCDIR=\"-I $HDF5_INC_DIR\"<\/span>\n<span class=\"nv\">HDF5_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-L <\/span><span class=\"nv\">$HDF5_LIB_DIR<\/span><span class=\"s2\">\"<\/span>\n<span class=\"nv\">HDF5_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"-lhdf5_hl -lhdf5 -lz\"<\/span>\n\n<span class=\"nv\">OASIS_INCDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">OASIS_LIBDIR<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"nv\">OASIS_LIB<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\"<\/span>\n<span class=\"c\">#OASIS_INCDIR=\"-I$PWD\/..\/..\/prism\/X64\/build\/lib\/psmile.MPI1\"<\/span>\n<span class=\"c\">#OASIS_LIBDIR=\"-L$PWD\/..\/..\/prism\/X64\/lib\"<\/span>\n<span class=\"c\">#OASIS_LIB=\"-lpsmile.MPI1 -lmpp_io\"<\/span><\/code><\/pre><\/figure>\n\n<p>And then install XIOS by running the following command in the XIOS folder.<\/p>\n\n<p>In my case, all of the above was:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">svn co <span class=\"nt\">-r<\/span> 1011 http:\/\/forge.ipsl.jussieu.fr\/ioserver\/svn\/XIOS\/trunk XIOS     <span class=\"c\">#need to use a tested version of the xios 2<\/span>\n<span class=\"nb\">cd<\/span> \/path\/to\/where\/you\/cloned\/xios\/arch\n<span class=\"nb\">cp<\/span> \/work\/n02\/n02\/shared\/baspog\/arch-for-xios\/<span class=\"k\">*<\/span> <span class=\"nb\">.<\/span> <span class=\"c\">#copy the arch files; the .fcm, .path and .env files are the same as before<\/span>\n<span class=\"nb\">cd<\/span> ..\n<span class=\"nb\">chmod<\/span> +x make_xios \n.\/make_xios <span class=\"nt\">--prod<\/span> <span class=\"nt\">--full<\/span> <span class=\"nt\">--arch<\/span> XC30_ARCHER  <span class=\"nt\">--jobs<\/span> 8<\/code><\/pre><\/figure>\n\n<p>The build took 1435 seconds (using the above module versions).<\/p>\n\n<h3 id=\"nemo\">NEMO<\/h3>\n\n<p>We are using the G06 Met Office revision, clone it (put your NEMO repository username in):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">mkdir<\/span> <span class=\"nt\">-p<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\n<span class=\"nb\">cd<\/span> \/fs2\/n02\/n02\/chbull\/nemo\/models\nsvn <span class=\"nt\">--username<\/span> <span class=\"s1\">'chrisbull'<\/span> co http:\/\/forge.ipsl.jussieu.fr\/nemo\/svn\/branches\/UKMO\/dev_r5518_GO6_package@9583<\/code><\/pre><\/figure>\n\n<p>Open NEMOGCM\/ARCH\/arch-XC_ARCHER_INTEL.fcm and make sure the variables \u201cNDF_HOME\u201d, \u201cHDF5_HOME\u201d and \u201cXIOS_HOME\u201d point to the netCDF, HDF, and XIOS directories. netCDF and HDF5 directories can be found by running <code class=\"language-plaintext highlighter-rouge\">nc-config --all<\/code>. XIOS_HOME should be where you installed XIOS.<\/p>\n\n<p>In my case, this looked like the following \u201carch\u201d file (compiler settings):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">%NCDF_HOME           \/opt\/cray\/netcdf-hdf5parallel\/4.4.1.1\/INTEL\/15.0\/\n%NCDF_HOME_FORTRAN   \/opt\/cray\/netcdf-hdf5parallel\/4.4.1.1\/INTEL\/15.0\/\n%HDF5_HOME           \/opt\/cray\/hdf5\/1.10.0.1\/INTEL\/15.0\/\n%XIOS_HOME           \/fs2\/n02\/n02\/chbull\/nemo\/models\/XIOS\/\n\n%NCDF_INC            <span class=\"nt\">-I<\/span>%NCDF_HOME\/include <span class=\"nt\">-I<\/span>%NCDF_HOME_FORTRAN\/include\n%NCDF_LIB            <span class=\"nt\">-L<\/span>%NCDF_HOME\/lib <span class=\"nt\">-lnetcdf<\/span> <span class=\"nt\">-L<\/span>%NCDF_HOME_FORTRAN\/lib <span class=\"nt\">-lnetcdff<\/span>\n%XIOS_INC            <span class=\"nt\">-I<\/span>%XIOS_HOME\/inc \n%XIOS_LIB            <span class=\"nt\">-L<\/span>%XIOS_HOME\/lib <span class=\"nt\">-lxios<\/span>\n\n%CPP                 cpp\n%FC                  ftn\n%FCFLAGS             <span class=\"nt\">-integer-size<\/span> 32 <span class=\"nt\">-real-size<\/span> 64 <span class=\"nt\">-O3<\/span> <span class=\"nt\">-fp-model<\/span> precise <span class=\"nt\">-zero<\/span> <span class=\"nt\">-fpp<\/span> <span class=\"nt\">-warn<\/span> all\n%FFLAGS              <span class=\"nt\">-integer-size<\/span> 32 <span class=\"nt\">-real-size<\/span> 64 <span class=\"nt\">-O3<\/span> <span class=\"nt\">-fp-model<\/span> precise <span class=\"nt\">-zero<\/span> <span class=\"nt\">-fpp<\/span> <span class=\"nt\">-warn<\/span> all\n%LD                  CC <span class=\"nt\">-Wl<\/span>,<span class=\"s2\">\"--allow-multiple-definition\"<\/span>\n%FPPFLAGS            <span class=\"nt\">-P<\/span> <span class=\"nt\">-C<\/span> <span class=\"nt\">-traditional<\/span>\n%LDFLAGS\n%AR                  ar \n%ARFLAGS             <span class=\"nt\">-r<\/span>\n%MK                  gmake\n%USER_INC            %XIOS_INC %NCDF_INC\n%USER_LIB            %XIOS_LIB %NCDF_LIB<\/code><\/pre><\/figure>\n\n<p>Put here: <code class=\"language-plaintext highlighter-rouge\">\/fs2\/n02\/n02\/chbull\/nemo\/models\/dev_r5518_GO6_package\/NEMOGCM\/ARCH\/arch-XC_ARCHER_INTEL.fcm<\/code>.<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/nemo\/nemo-wed12-01\/\">Downloading NEMO and installing XIOS on ARCHER (Step 1)<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on May 17, 2018.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/superfast-griddedsubplots\/"}},"id":"https:\/\/cbull.info\/python\/superfast-griddedsubplots","published":"2016-03-14T00:30:00+00:00","updated":"2016-03-14T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">Plthacks is a Python package that wraps Matplotlib to make common (tedius) tasks faster, this post is about creating a grid of an arbitrary number of plots from an ordered dictionary.<\/p>\n\n<p>I reguarly find myself wanting to display multiple fields. I find it frustrating how many lines you need in Matplotlib to grid plots such that they have things like:<\/p>\n\n<ul>\n  <li>when sharing an axis removing ticks and labels where appropriate;<\/li>\n  <li>displaying one colourbar for each subplot or a global colourbar for all plots;<\/li>\n  <li>adjusting subplot size according to the above.<\/li>\n<\/ul>\n\n<p><a href=\"https:\/\/github.com\/chrisb13\/plthacks\">Plthacks<\/a>.Grid Class is an attempt to make this much faster. Let\u2019s see an example.<\/p>\n\n<p>This package is under development, this post refers to <a href=\"https:\/\/github.com\/chrisb13\/plthacks\/commit\/5b193d89ae018aa8a0822c5d722f4dcad2f345c1\">this SHA of the code<\/a>.<\/p>\n\n<p>\u2018Install\u2019 the package somewhere you\u2019ll import it..<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">git clone https:\/\/github.com\/chrisb13\/plthacks\n<span class=\"nb\">cd <\/span>plthacks\ngit reset <span class=\"nt\">--hard<\/span> 5b193d89ae018aa8a0822c5d722f4dcad2f345c1<\/code><\/pre><\/figure>\n\n<p>To start, we\u2019ll just create some data and store it in an ordered dictionary called plotdict. We also optionally specify each subplot\u2019s dimension labels and colorbars, called dimlab and colorbars respectively.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"kn\">import<\/span> <span class=\"nn\">plthacks<\/span> <span class=\"k\">as<\/span> <span class=\"n\">plth<\/span> \n\n<span class=\"c1\">#this package requires numpy and matplotlib\n<\/span><span class=\"kn\">import<\/span> <span class=\"nn\">numpy<\/span> <span class=\"k\">as<\/span> <span class=\"n\">np<\/span>\n\n<span class=\"c1\">#these two are part of core python\n<\/span><span class=\"kn\">import<\/span> <span class=\"nn\">collections<\/span>\n<span class=\"kn\">import<\/span> <span class=\"nn\">itertools<\/span>\n\n<span class=\"c1\">#place to put the plot, if an output is not specified (when calling Grid Class), then it will return the matplotlib figure object\n<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">=<\/span><span class=\"s\">'\/tmp\/testplots\/'<\/span>\n\n<span class=\"c1\">#we will show how you can specify different colormaps in a minute\n<\/span><span class=\"n\">colormaps<\/span><span class=\"o\">=<\/span><span class=\"n\">itertools<\/span><span class=\"p\">.<\/span><span class=\"n\">cycle<\/span><span class=\"p\">([<\/span><span class=\"s\">'Accent'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Dark2'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Paired'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Pastel1'<\/span><span class=\"p\">,<\/span>\\\n        <span class=\"s\">'Pastel2'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Set1'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Set2'<\/span><span class=\"p\">,<\/span> <span class=\"s\">'Set3'<\/span><span class=\"p\">])<\/span>\n\n<span class=\"c1\">#The following three ordered dictionaries are ordered by each subplot where they contain:\n#plotdict is the fields to contourf\n<\/span><span class=\"n\">plotdict<\/span><span class=\"o\">=<\/span><span class=\"n\">collections<\/span><span class=\"p\">.<\/span><span class=\"n\">OrderedDict<\/span><span class=\"p\">()<\/span>\n<span class=\"c1\">#(optional) dimlab is the labels for the x\/y axis\n<\/span><span class=\"n\">dimlab<\/span><span class=\"o\">=<\/span><span class=\"n\">collections<\/span><span class=\"p\">.<\/span><span class=\"n\">OrderedDict<\/span><span class=\"p\">()<\/span>\n<span class=\"c1\">#(optional) colorbars are the colourmaps to use \n<\/span><span class=\"n\">colorbars<\/span><span class=\"o\">=<\/span><span class=\"n\">collections<\/span><span class=\"p\">.<\/span><span class=\"n\">OrderedDict<\/span><span class=\"p\">()<\/span>\n\n<span class=\"c1\">#this will be the title in the box of each subplot, we are making 12 but you can try a different number if you like...\n<\/span><span class=\"n\">cnts<\/span><span class=\"o\">=<\/span><span class=\"p\">[<\/span><span class=\"nb\">str<\/span><span class=\"p\">(<\/span><span class=\"n\">cnt<\/span><span class=\"p\">)<\/span> <span class=\"k\">for<\/span> <span class=\"n\">cnt<\/span> <span class=\"ow\">in<\/span> <span class=\"n\">np<\/span><span class=\"p\">.<\/span><span class=\"n\">arange<\/span><span class=\"p\">(<\/span><span class=\"mi\">12<\/span><span class=\"p\">)<\/span><span class=\"o\">+<\/span><span class=\"mi\">1<\/span><span class=\"p\">]<\/span>\n\n<span class=\"k\">for<\/span> <span class=\"n\">cnt<\/span> <span class=\"ow\">in<\/span> <span class=\"n\">cnts<\/span><span class=\"p\">:<\/span>\n    <span class=\"c1\">#plotdict[cnt]=np.random.rand(200,150)\n<\/span>    <span class=\"n\">plotdict<\/span><span class=\"p\">[<\/span><span class=\"n\">cnt<\/span><span class=\"p\">]<\/span><span class=\"o\">=<\/span><span class=\"n\">np<\/span><span class=\"p\">.<\/span><span class=\"n\">random<\/span><span class=\"p\">.<\/span><span class=\"n\">rand<\/span><span class=\"p\">(<\/span><span class=\"mi\">20<\/span><span class=\"p\">,<\/span><span class=\"mi\">15<\/span><span class=\"p\">)<\/span>\n    <span class=\"n\">dimlab<\/span><span class=\"p\">[<\/span><span class=\"n\">cnt<\/span><span class=\"p\">]<\/span><span class=\"o\">=<\/span><span class=\"p\">(<\/span><span class=\"s\">'xlabel'<\/span><span class=\"p\">,<\/span><span class=\"s\">'ylabel'<\/span><span class=\"p\">)<\/span>\n    <span class=\"n\">colorbars<\/span><span class=\"p\">[<\/span><span class=\"n\">cnt<\/span><span class=\"p\">]<\/span><span class=\"o\">=<\/span><span class=\"n\">colormaps<\/span><span class=\"p\">.<\/span><span class=\"nb\">next<\/span><span class=\"p\">()<\/span><\/code><\/pre><\/figure>\n\n<p>We\u2019ll now show 10 different usages of the Grid class so you get the idea of what it can do.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">sepcbar<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'001_GridEgDimLabSepcbar.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/001_GridEgDimLabSepcbar.png\"><img src=\"\/images\/plthacks_Grid\/001_GridEgDimLabSepcbar.png\" \/><\/a><\/p>\n\n<p>Neat right? So you\u2019ll notice we\u2019ve opted for 4 rows and 3 columns with 12 plots but the grid can be whatever we like (I hope!).<\/p>\n\n<p>We can do a few other things too, such as:<\/p>\n\n<ul>\n  <li>share x-axis\/share y-axis<\/li>\n  <li>include\/exclude dimension labels<\/li>\n  <li>include\/exclude local or global colourbar(s)<\/li>\n  <li>have different colourmaps for each subplot<\/li>\n<\/ul>\n\n<p>These options are described in the Grid docstring:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"s\">\"\"\"\nClass to create a gridded set of subplots from a dictionary.\n\nParameters\n----------\npdict: dictionary containing the arrays to plot, titles are taken from the key\npdims: tuple with (rowdim,coldim)\nsharex (optional): share all the x axis in the grid\nsharey (optional): share all the y axis in the grid\ndimlabels (optional): dictionary containing tuples of xlabel and ylabels \nsepcbar (optional): separate colorbars for each subplot (True or False)\nglobalcbar (optional): a single colorbar for the whole plot (string where the options are: 'True' which will use default colormap or name of matplotlib colormap)\ncbars (optional): dictionary containing matplotlib colourbars to use\nclevels (optional): integer for the number of contour levels\noutputpath (optional): full path of file to put plot in (if left out it won't be created)\n\nReturns\n-------\n\nNotes\n-------\n* If you use sepcbar, then best not to use sharex or sharey.<\/span><\/code><\/pre><\/figure>\n\n<p>You\u2019ll notice in the above example we used the optional dimlabels and sepcbar. Here\u2019s some more examples.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">cbars<\/span><span class=\"o\">=<\/span><span class=\"n\">colorbars<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'002_GridEgDimLabcbars.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/002_GridEgDimLabcbars.png\"><img src=\"\/images\/plthacks_Grid\/002_GridEgDimLabcbars.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">cbars<\/span><span class=\"o\">=<\/span><span class=\"n\">colorbars<\/span><span class=\"p\">,<\/span><span class=\"n\">clevels<\/span><span class=\"o\">=<\/span><span class=\"mi\">8<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'003_GridEgDimLabclevelscbars.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/003_GridEgDimLabclevelscbars.png\"><img src=\"\/images\/plthacks_Grid\/003_GridEgDimLabclevelscbars.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">globalcbar<\/span><span class=\"o\">=<\/span><span class=\"s\">'True'<\/span><span class=\"p\">,<\/span><span class=\"n\">clevels<\/span><span class=\"o\">=<\/span><span class=\"mi\">20<\/span><span class=\"p\">,<\/span><span class=\"n\">sharex<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">sharey<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'004_GridEgDimLabShareXShareYglobalcbarclevels.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/004_GridEgDimLabShareXShareYglobalcbarclevels.png\"><img src=\"\/images\/plthacks_Grid\/004_GridEgDimLabShareXShareYglobalcbarclevels.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">globalcbar<\/span><span class=\"o\">=<\/span><span class=\"s\">'Accent'<\/span><span class=\"p\">,<\/span><span class=\"n\">clevels<\/span><span class=\"o\">=<\/span><span class=\"mi\">20<\/span><span class=\"p\">,<\/span><span class=\"n\">sharex<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">sharey<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'005_GridEgDimLabShareXShareYglobalcbarAccentclevels.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/005_GridEgDimLabShareXShareYglobalcbarAccentclevels.png\"><img src=\"\/images\/plthacks_Grid\/005_GridEgDimLabShareXShareYglobalcbarAccentclevels.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">sharex<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'006_GridEgShareX.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/006_GridEgShareX.png\"><img src=\"\/images\/plthacks_Grid\/006_GridEgShareX.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">sharey<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'007_GridEgSHareY.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/007_GridEgSHareY.png\"><img src=\"\/images\/plthacks_Grid\/007_GridEgSHareY.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">sharex<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">sharey<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'008_GridEgShareXShareY.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/008_GridEgShareXShareY.png\"><img src=\"\/images\/plthacks_Grid\/008_GridEgShareXShareY.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'009_GridEgDimLab.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/009_GridEgDimLab.png\"><img src=\"\/images\/plthacks_Grid\/009_GridEgDimLab.png\" \/><\/a><\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">plth<\/span><span class=\"p\">.<\/span><span class=\"n\">Grid<\/span><span class=\"p\">(<\/span><span class=\"n\">plotdict<\/span><span class=\"p\">,(<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"mi\">3<\/span><span class=\"p\">),<\/span><span class=\"n\">sharex<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">sharey<\/span><span class=\"o\">=<\/span><span class=\"bp\">True<\/span><span class=\"p\">,<\/span><span class=\"n\">dimlabels<\/span><span class=\"o\">=<\/span><span class=\"n\">dimlab<\/span><span class=\"p\">,<\/span><span class=\"n\">outputpath<\/span><span class=\"o\">=<\/span><span class=\"n\">plotoutputs<\/span><span class=\"o\">+<\/span><span class=\"s\">'010_GridEgShareXShareYDimLab.png'<\/span><span class=\"p\">)<\/span><\/code><\/pre><\/figure>\n\n<p>Results in:\n<a href=\"\/images\/plthacks_Grid\/010_GridEgShareXShareYDimLab.png\"><img src=\"\/images\/plthacks_Grid\/010_GridEgShareXShareYDimLab.png\" \/><\/a><\/p>\n\n<p>All of these examples are in <a href=\"https:\/\/github.com\/chrisb13\/plthacks\/blob\/5b193d89ae018aa8a0822c5d722f4dcad2f345c1\/tests.py\">tests.py here<\/a>.<\/p>\n\n<p>Of course, it\u2019s super hard to create a Class that will work in all instances. I\u2019ve written it with the idea that one could just copy the whole Class in main.py and hack it, if the set up described here is inadequate. Similarly, the Class will return all the matplotlib axis (see self.paxis dictionary). Hopefully it\u2019s a useful starting point though. Pull requests most welcome!<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/python\/superfast-griddedsubplots\/\">Python package for gridding subplots, fast!<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on March 14, 2016.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/oneline-movies-mkmov\/"}},"id":"https:\/\/cbull.info\/python\/oneline-movies-mkmov","published":"2016-01-22T00:30:00+00:00","updated":"2016-01-22T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p><strong>Update 10.10.2016<\/strong>. MkMov 0.4 now supports a bunch of other outputs, see <a href=\"http:\/\/christopherbull.com.au\/mkmov\/usage.html\">usage<\/a> for details.<\/p>\n\n<p class=\"notice\">MkMov is a Python package that creates a movie from a netCDF file with a single line, interface is command line (no python knowledge needed)!<\/p>\n\n<p>I reguarly find myself making movies for sanity checks on model runs, other times I\u2019ll want a movie for a talk or perhaps to look at how some diagnostic plot varies over time. Suffice to say a few people have asked me how I create movies from netCDF files, such questions spurred the development of\u2026<\/p>\n\n<p><a href=\"https:\/\/github.com\/chrisb13\/mkmov\">MkMov<\/a>, a python package for making movies. In can be used in two ways:<\/p>\n\n<ol>\n  <li>from a netCDF file<\/li>\n  <li>from a list of png files (use \u2013stitch option)<\/li>\n<\/ol>\n\n<p>Examples tell a thousand words, <a href=\"https:\/\/youtube.com\/embed\/JEMj05o-KA4\">here\u2019s a movie (AVISO global allsat madt, output is daily and variable is adt)<\/a><\/p>\n\n<p>Created with a single line command, namely<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">python mkmov.py 2d adt <span class=\"nt\">--lmask<\/span> <span class=\"nt\">-214748<\/span> <span class=\"nt\">--cmap<\/span> Set3 <span class=\"nt\">-o<\/span> \/srv\/ccrc\/data42\/z3457920\/mkmovmovies4\/AVISOdt_global_allsat_madt_Set3.mov \/srv\/ccrc\/data42\/z3457920\/RawData\/AVISO\/RawData\/dt_global_allsat_madt\/ftp.aviso.altimetry.fr\/global\/delayed-time\/grids\/madt\/all-sat-merged\/h\/<span class=\"k\">*<\/span>\/<span class=\"k\">*<\/span>.nc &amp;&gt;  \/srv\/ccrc\/data42\/z3457920\/mkmovmovies4\/15.log &amp;<\/code><\/pre><\/figure>\n\n<p>More examples with their respective run commands <a href=\"http:\/\/christopherbull.com.au\/mkmov\/examples.html\">here<\/a>. Official <a href=\"http:\/\/www.christopherbull.com.au\/mkmov\">docs are here<\/a>. <a href=\"http:\/\/www.christopherbull.com.au\/mkmov\/contributing.html\">Contributions<\/a> are most welcome.<\/p>\n\n<p>You might be wondering what this tool offers over something like ncview and a screen grabber program.<\/p>\n\n<p>Pros:<\/p>\n\n<ol>\n  <li>bash scriptable<\/li>\n  <li>customisable output (e.g. \u2013clev, \u2013cmap <a href=\"http:\/\/christopherbull.com.au\/mkmov\/usage.html\">etc<\/a>)<\/li>\n  <li>can take multiple files as input<\/li>\n  <li>can wrap ffmpeg to stitch together any png files<\/li>\n<\/ol>\n\n<p>Cons:<\/p>\n\n<ol>\n  <li>slow in comparison to ncview<\/li>\n  <li>need to install dependencies<\/li>\n<\/ol>\n\n\n    <p><a href=\"https:\/\/cbull.info\/python\/oneline-movies-mkmov\/\">Python package for one-line creation of movies from netCDF files.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on January 22, 2016.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/lightning-netcdf\/"}},"id":"https:\/\/cbull.info\/python\/lightning-netcdf","published":"2015-12-02T00:30:00+00:00","updated":"2015-12-02T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>I often finding myself wanting basic information about netCDF files and needing to inspect it in Python <em>quickly<\/em>.<\/p>\n\n<p>I\u2019ve written a bash function that takes a passed path of a netCDF file, it then writes a short python script and loads it into a ipython console. The console then prints out basic information about the file and all the variable names, ready for you to hack away!<\/p>\n\n<p>For this bash function you\u2019ll need:<\/p>\n\n<ol>\n  <li>python 2.x<\/li>\n  <li>python netCDF4 library<\/li>\n  <li>ipython<\/li>\n<\/ol>\n\n<p>Here\u2019s the function:<\/p>\n\n<script src=\"https:\/\/gist.github.com\/62b159a374bb0763c569.js\"> <\/script>\n\n<p>The above is a <a href=\"https:\/\/help.github.com\/articles\/about-gists\/\">GitHub gists<\/a>, feel free to comment\/fork\/pull! If you\u2019ve found this handy, you might also like my <a href=\"http:\/\/christopherbull.com.au\/hpc\/vim-ncdump-shortcut\/\">Vim and UltiSnip<\/a> for similar stuff.<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/python\/lightning-netcdf\/\">Bash function for super fast loading of netCDF files in Python.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on December 02, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/python-package-mkpaper\/"}},"id":"https:\/\/cbull.info\/python\/python-package-mkpaper","published":"2015-11-25T00:30:00+00:00","updated":"2015-11-25T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p class=\"notice\">MkPaper creates a figure document in 3 + n lines of code, where n is the number of figures you have!<\/p>\n\n<p>Have you ever wished a machine would write your paper for you?<\/p>\n\n<p>Wish no more, the future is here!* I\u2019ve created a Python package that will compile a LaTeX or word document of figures. Basically, you feed the package a path to a figure and a caption and then it will create either:<\/p>\n\n<ol>\n  <li>a PDFLaTeX document or a<\/li>\n  <li>Word Document<\/li>\n<\/ol>\n\n<p><em>with those figures and captions inserted<\/em>! I\u2019ve tried to make it as simple and painless to install as possible (just clone the repo\u2019); dependencies are kept to a minimum, specifically:<\/p>\n\n<ol>\n  <li>python 2.x<\/li>\n  <li>pdflatex (optional)<\/li>\n  <li>python-docx (optional)<\/li>\n<\/ol>\n\n<p>Without pdflatex, the package still works (you can create the tex file and not compile). To create a Word document you need python-docx (installable with Anaconda).<\/p>\n\n<p>To install the package:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">git<\/span> <span class=\"n\">clone<\/span> <span class=\"n\">https<\/span><span class=\"p\">:<\/span><span class=\"o\">\/\/<\/span><span class=\"n\">github<\/span><span class=\"p\">.<\/span><span class=\"n\">com<\/span><span class=\"o\">\/<\/span><span class=\"n\">chrisb13<\/span><span class=\"o\">\/<\/span><span class=\"n\">mkpaper<\/span><span class=\"p\">.<\/span><span class=\"n\">git<\/span><\/code><\/pre><\/figure>\n\n<p>And then, suppose you want to create a word doc, usage looks like\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"kn\">import<\/span> <span class=\"nn\">mkpaper<\/span> <span class=\"k\">as<\/span> <span class=\"n\">mp<\/span>\n\n<span class=\"c1\">#get a list of your figures in PNG format...\n<\/span><span class=\"kn\">import<\/span> <span class=\"nn\">glob<\/span>\n<span class=\"n\">ifiles<\/span><span class=\"o\">=<\/span><span class=\"nb\">sorted<\/span><span class=\"p\">(<\/span><span class=\"n\">glob<\/span><span class=\"p\">.<\/span><span class=\"n\">glob<\/span><span class=\"p\">(<\/span><span class=\"n\">path_to_pngplots<\/span> <span class=\"o\">+<\/span> <span class=\"s\">'*.png'<\/span> <span class=\"p\">))<\/span>\n<span class=\"k\">assert<\/span><span class=\"p\">(<\/span><span class=\"n\">ifiles<\/span><span class=\"o\">!=<\/span><span class=\"p\">[]),<\/span><span class=\"s\">\"glob didn't find anything!\"<\/span>\n\n<span class=\"c1\">#alternatively, we could be more explicit\n#ifile[0]=path_to_doc+'penguin1.png'\n#ifile[1]=path_to_doc+'penguin2.png'\n<\/span>\n<span class=\"c1\">#instantiate WordFigureDoc class:\n#arguments are: path\/to\/put\/figuredocs and name of figure doc..\n<\/span><span class=\"n\">figobj<\/span><span class=\"o\">=<\/span><span class=\"n\">mp<\/span><span class=\"p\">.<\/span><span class=\"n\">WordFigureDoc<\/span><span class=\"p\">(<\/span><span class=\"n\">path_to_doc<\/span><span class=\"p\">,<\/span><span class=\"s\">'penguinfigs'<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">figobj<\/span><span class=\"p\">.<\/span><span class=\"n\">add_figure<\/span><span class=\"p\">(<\/span><span class=\"n\">ifiles<\/span><span class=\"p\">[<\/span><span class=\"mi\">0<\/span><span class=\"p\">],<\/span><span class=\"s\">'first penguin'<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">figobj<\/span><span class=\"p\">.<\/span><span class=\"n\">add_figure<\/span><span class=\"p\">(<\/span><span class=\"n\">ifiles<\/span><span class=\"p\">[<\/span><span class=\"mi\">1<\/span><span class=\"p\">],<\/span><span class=\"s\">'second penguin'<\/span><span class=\"p\">)<\/span>\n<span class=\"c1\">#etc\n<\/span>\n<span class=\"c1\">#insert the tail of the doc\n<\/span><span class=\"n\">figobj<\/span><span class=\"p\">.<\/span><span class=\"n\">end_doc<\/span><span class=\"p\">()<\/span><\/code><\/pre><\/figure>\n\n<p>Want to get started? Head over to the <a href=\"http:\/\/github.com\/chrisb13\/mkpaper\">GitHub project here.<\/a>. Full working examples in <a href=\"https:\/\/github.com\/chrisb13\/mkpaper\/tree\/master\/examples\">here<\/a>, so you should be up and running in no time!<\/p>\n\n<p>Feedback and pull requests welcome!<\/p>\n\n<p>*A touch of hyperbole here ;)<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/python\/python-package-mkpaper\/\">Programmatic paper writing with MkPaper<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on November 25, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/hpc\/vim-shortcut-ncdump\/"}},"id":"https:\/\/cbull.info\/hpc\/vim-shortcut-ncdump","published":"2015-11-11T00:30:00+00:00","updated":"2015-11-11T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>I often finding myself wanting basic information about netCDF files when writing scripts that read\/write netCDF files\u2026<\/p>\n\n<p>The following ncdump command provides a useful overview. The mapping grabs the clipboard register and opens the corresponding netcdf header in a new vim vertical split..<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-vim\" data-lang=\"vim\">nnoremap <span class=\"p\">&lt;<\/span>leader<span class=\"p\">&gt;<\/span>nc <span class=\"p\">:<\/span><span class=\"k\">vnew<\/span><span class=\"p\">&lt;<\/span>Bar<span class=\"p\">&gt;<\/span><span class=\"m\">0<\/span><span class=\"k\">r<\/span><span class=\"p\">!<\/span>ncdump <span class=\"p\">-<\/span><span class=\"k\">c<\/span> <span class=\"p\">&lt;<\/span>C<span class=\"p\">-<\/span>R<span class=\"p\">&gt;+&lt;<\/span>CR<span class=\"p\">&gt;<\/span><\/code><\/pre><\/figure>\n\n<p>What about if you want to have a quick look at a plot of one of the variables? Works with ncview too!<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-vim\" data-lang=\"vim\">nnoremap <span class=\"p\">&lt;<\/span>leader<span class=\"p\">&gt;<\/span>ncv <span class=\"p\">:<\/span>exec <span class=\"s1\">'!ncview &lt;C-R&gt;+'<\/span><span class=\"p\">&lt;<\/span>CR<span class=\"p\">&gt;<\/span><\/code><\/pre><\/figure>\n\n<p>Speaking of working with netCDF files, here\u2019s a handy <a href=\"https:\/\/github.com\/sirver\/ultisnips\">snippet<\/a> for the python library\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">snippet<\/span> <span class=\"n\">loadnetcdf<\/span>\n<span class=\"kn\">from<\/span> <span class=\"nn\">netCDF4<\/span> <span class=\"kn\">import<\/span> <span class=\"n\">Dataset<\/span>\n<span class=\"n\">infile<\/span><span class=\"o\">=<\/span><span class=\"s\">'\/path\/to\/netcdf4\/file.nc'<\/span>\n<span class=\"n\">ifile<\/span><span class=\"o\">=<\/span><span class=\"n\">Dataset<\/span><span class=\"p\">(<\/span><span class=\"n\">infile<\/span><span class=\"p\">,<\/span> <span class=\"s\">'r'<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">varone<\/span><span class=\"o\">=<\/span><span class=\"n\">ifile<\/span><span class=\"p\">.<\/span><span class=\"n\">variables<\/span><span class=\"p\">[<\/span><span class=\"s\">''<\/span><span class=\"p\">]<\/span>\n<span class=\"n\">endsnippet<\/span><\/code><\/pre><\/figure>\n\n\n    <p><a href=\"https:\/\/cbull.info\/hpc\/vim-shortcut-ncdump\/\">Vim and netCDF files.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on November 11, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/docopt-ultisnip\/"}},"id":"https:\/\/cbull.info\/python\/docopt-ultisnip","published":"2015-10-01T00:30:00+00:00","updated":"2015-10-01T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>I recently discovered <a href=\"https:\/\/github.com\/docopt\/docopt\">docopt<\/a>, this super neat command line parser. I\u2019ve used sys.argv and the argparse module but they\u2019ve always felt too limited or overly complicated (respectively). What\u2019s great about docopt is that it understands what to do based on the POSIX-style doc string you write! This has two advantages\u2026<\/p>\n\n<ol>\n  <li>You\u2019ve likely used enough *nix command-line tools to have a sense of what your doc string should look like (if you do get lost <a href=\"https:\/\/github.com\/docopt\/docopt\">the docs<\/a> are great).<\/li>\n  <li>It forces you to write documentation!<\/li>\n<\/ol>\n\n<p>There\u2019s a <a href=\"http:\/\/docopt.org\/\">video<\/a> here if you want a demo. Whilst it\u2019s not part of core python, one of the neat things is that it is fully self-contained within a single file. Thus, you can \u2018install\u2019 it with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\">wget https:\/\/raw.githubusercontent.com\/docopt\/docopt\/master\/docopt.py<\/code><\/pre><\/figure>\n\n<p>Anyway, I\u2019ve written a <a href=\"http:\/\/vimcasts.org\/episodes\/ultisnips-python-interpolation\/\">Vim Ultisnip<\/a> to do all the work for you\u2026\n<script src=\"https:\/\/gist.github.com\/a1e813302a0c9fbd9759.js\"> <\/script>\nThis is one of the more useful Ultisnip interpolation uses I\u2019ve found, you read correctly, it\u2019ll \u2018install\u2019 docopt for you!<\/p>\n\n<p>The above is a gist, feel free to comment\/fork\/pull.<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/python\/docopt-ultisnip\/\">Beautiful argument parsing with docopt and ultisnips.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on October 01, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/hpc\/bash-function-clipit\/"}},"id":"https:\/\/cbull.info\/hpc\/bash-function-clipit","published":"2015-09-05T00:30:00+00:00","updated":"2015-09-05T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>Do you remember the moment when you realised in Linux that clicking the mouse wheel pasted selected text? I had a similar reveleation when I discovered xclip recently, a handy utility for pushing text into the clipboard. I\u2019m forever copying and pasting paths from SSH sessions so here\u2019s a bash function that does the work for you\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"k\">function <\/span>clipit<span class=\"o\">()<\/span> <span class=\"c\">#clipit path <\/span>\n<span class=\"o\">{<\/span>\n    <span class=\"k\">if<\/span> <span class=\"o\">[[<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$# <\/span><span class=\"nt\">-eq<\/span> 0 <span class=\"o\">)<\/span> <span class=\"o\">||<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$1<\/span> <span class=\"o\">==<\/span> <span class=\"s2\">\"--help\"<\/span> <span class=\"o\">)<\/span> <span class=\"o\">||<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$1<\/span> <span class=\"o\">==<\/span> <span class=\"s2\">\"-h\"<\/span> <span class=\"o\">)<\/span> <span class=\"o\">]]<\/span> <span class=\"p\">;<\/span> <span class=\"k\">then\n        <\/span><span class=\"nb\">echo<\/span> <span class=\"s2\">\"Usage: clipit FILENAME_PATHNAME\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Purpose: gets full path of file or path and places in clipboard.\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Requires: xclip\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Mandatory arguments: \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"FILENAME_PATHNAME: path to folder or file\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Example.\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"clipit filename.txt\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"becomes:       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"readlink -e filename.txt|tr -d '<\/span><span class=\"se\">\\n<\/span><span class=\"s2\">'|xclip -selection c\"<\/span>\n\n        <span class=\"k\">return <\/span>1\n    <span class=\"k\">fi\n  <\/span><span class=\"nb\">readlink<\/span> <span class=\"nt\">-e<\/span> <span class=\"k\">${<\/span><span class=\"nv\">1<\/span><span class=\"k\">}<\/span>|tr <span class=\"nt\">-d<\/span> <span class=\"s1\">'\\n'<\/span>|xclip <span class=\"nt\">-selection<\/span> c\n<span class=\"o\">}<\/span><\/code><\/pre><\/figure>\n\n<p>If you\u2019re got apt-get and sudo rights, then you can install xclip with:<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">sudo <\/span>apt-get <span class=\"nb\">install <\/span>xclip<\/code><\/pre><\/figure>\n\n<p>If you don\u2019t have either of the above, then you can compile from source with (defaults to the slow but likely available GNU compiler):<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"nb\">cd \n<\/span>wget wget http:\/\/downloads.sourceforge.net\/project\/xclip\/xclip\/0.12\/xclip-0.12.tar.gz\n<span class=\"nb\">tar<\/span> <span class=\"nt\">-xvf<\/span> xclip-0.12.tar.gz\n<span class=\"nb\">mv <\/span>xclip-0.12 xclip\n<span class=\"nb\">cd <\/span>xclip\n.\/configure <span class=\"nt\">--prefix<\/span><span class=\"o\">=<\/span><span class=\"nv\">$HOME<\/span>\/xclip\nmake<\/code><\/pre><\/figure>\n\n<p>Seems like a bit of work but it\u2019s pretty quick. And then, once compiled, add the following to your ~\/.bashrc\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"c\">#add xclip to the end of bash path<\/span>\n<span class=\"nv\">PATH<\/span><span class=\"o\">=<\/span><span class=\"nv\">$PATH<\/span>:~\/xclip\/<\/code><\/pre><\/figure>\n\n<p>This assumes that you compiled in ~\/xclip\/ as above. Happy speedy copy\/pasting!<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/hpc\/bash-function-clipit\/\">Grabbing paths straight to the clipboard.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on September 05, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/hpc\/bash-function-rsync\/"}},"id":"https:\/\/cbull.info\/hpc\/bash-function-rsync","published":"2015-08-18T00:30:00+00:00","updated":"2015-08-18T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>My life consists of two problems\u2026<\/p>\n\n<ol>\n  <li>I work on many different machines and the files I want are invariably on the wrong machine.<\/li>\n  <li>I can never remember the right rsync flags for the different machines I use and my fingers are lazy.<\/li>\n<\/ol>\n\n<p>The second problem means I never want to deal with the first two.. Sound familiar?<\/p>\n\n<p>Here\u2019s some bash functions to help you push and pull files from a remote location.<\/p>\n\n<p>We have one bash function for pulling files\u2026.\n<script src=\"https:\/\/gist.github.com\/7ea4e9620cbce4a80bfd.js\"> <\/script><\/p>\n\n<p>And another (slightly more complicated) bash function for pushing files\u2026.<\/p>\n\n<script src=\"https:\/\/gist.github.com\/432eade90ec68629d03a.js\"> <\/script>\n\n<p>So, if you put these in your <a href=\"http:\/\/superuser.com\/questions\/49289\/what-is-the-bashrc-file\">.bashrc<\/a> with your relevant server details you should be good to go! Feel free to change the switches if you prefer something else, do get in touch if you improve these, it\u2019s impractical to currently pass include\/exclude statements at present for instance\u2026 The above are <a href=\"https:\/\/help.github.com\/articles\/about-gists\/\">GitHub gists<\/a>, feel free to comment\/fork\/pull!<\/p>\n\n<p>Also, life is a lot more smooth if you\u2019re using <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-ssh-keys--2\">ssh keys<\/a>.<\/p>\n\n\n    <p><a href=\"https:\/\/cbull.info\/hpc\/bash-function-rsync\/\">Bash function for painless rsync.<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on August 18, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/hpc\/vim-netrw\/"}},"id":"https:\/\/cbull.info\/hpc\/vim-netrw","published":"2015-01-01T00:30:00+00:00","updated":"2015-01-01T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>I often find myself wanting to edit a file on a remote machine but ssh is too slow to be running a text editor on the remote machine.. Solution? Vim can use rsync to download a copy of the file and then when you save it, it saves it back to the remote location!<\/p>\n\n<p>Here\u2019s a bash function I wrote to make it all easy\u2026.<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-bash\" data-lang=\"bash\"><span class=\"k\">function <\/span>vim_servername<span class=\"o\">()<\/span> \n<span class=\"o\">{<\/span>\n    <span class=\"k\">if<\/span> <span class=\"o\">[[<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$# <\/span><span class=\"nt\">-eq<\/span> 0 <span class=\"o\">)<\/span> <span class=\"o\">||<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$1<\/span> <span class=\"o\">==<\/span> <span class=\"s2\">\"--help\"<\/span> <span class=\"o\">)<\/span> <span class=\"o\">||<\/span> <span class=\"o\">(<\/span> <span class=\"nv\">$1<\/span> <span class=\"o\">==<\/span> <span class=\"s2\">\"-h\"<\/span> <span class=\"o\">)<\/span> <span class=\"o\">]]<\/span> <span class=\"p\">;<\/span> <span class=\"k\">then\n        <\/span><span class=\"nb\">echo<\/span> <span class=\"s2\">\"Usage:   vim_servername [path_to].\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Purpose: Allows remote editing of files on servers...\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Mandatory arguments: \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"path or file: vim will either edit or open path passed\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Example.\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"This:\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"vim_servername \/server\/path\/or\/file\/\"<\/span>\n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"       \"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"Becomes:\"<\/span> \n        <span class=\"nb\">echo<\/span> <span class=\"s2\">\"vim scp:\/\/username@server.address.edu.au\/\/server\/path\/or\/file\/\"<\/span>\n\n        <span class=\"k\">return <\/span>1\n    <span class=\"k\">fi\n\n    <\/span>vim scp:\/\/username@server.address.edu.au\/<span class=\"k\">${<\/span><span class=\"nv\">1<\/span><span class=\"k\">}<\/span> \n\n<span class=\"o\">}<\/span><\/code><\/pre><\/figure>\n\n<p>So, just put these in your <a href=\"http:\/\/superuser.com\/questions\/49289\/what-is-the-bashrc-file\">.bashrc<\/a> with your relevant server details and you should be good to go! Best to be using <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-ssh-keys--2\">ssh keys<\/a>, that way you\u2019re not typing in your password everytime you save..<\/p>\n\n    <p><a href=\"https:\/\/cbull.info\/hpc\/vim-netrw\/\">Editing files remotely<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on January 01, 2015.<\/p>\n  "},{"title":{"@attributes":{"type":"html"}},"link":{"@attributes":{"rel":"alternate","type":"text\/html","href":"https:\/\/cbull.info\/python\/gotcha-in-pandas-using-hdfstore-frame_tables\/"}},"id":"https:\/\/cbull.info\/python\/gotcha-in-pandas-using-hdfstore-frame_tables","published":"2014-01-08T00:30:00+00:00","updated":"2014-01-08T00:30:00+00:00","author":{"name":{},"uri":"https:\/\/cbull.info"},"content":"\n    <p>Recently, I changed from using regular <a href=\"http:\/\/pandas.pydata.org\/pandas-docs\/dev\/io.html#io-hdf5\">pytable HDFStores to fancy frame_tables<\/a>. The move was mostly for the better as my HDFStores were big. Of course, my old code modifying the dataframes broke because of this little bit of syntax\u2026<\/p>\n\n<figure class=\"highlight\"><pre><code class=\"language-python\" data-lang=\"python\"><span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">1<\/span><span class=\"p\">]:<\/span> <span class=\"kn\">import<\/span> <span class=\"nn\">pandas<\/span> <span class=\"k\">as<\/span> <span class=\"n\">pd<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">2<\/span><span class=\"p\">]:<\/span> <span class=\"n\">p<\/span><span class=\"o\">=<\/span><span class=\"n\">pd<\/span><span class=\"p\">.<\/span><span class=\"n\">HDFStore<\/span><span class=\"p\">(<\/span><span class=\"s\">'\/path\/to\/some\/hdfstore.h5'<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">3<\/span><span class=\"p\">]:<\/span> <span class=\"n\">p<\/span><span class=\"p\">.<\/span><span class=\"n\">DF<\/span><span class=\"p\">[<\/span><span class=\"s\">'latitude'<\/span><span class=\"p\">][<\/span><span class=\"mi\">0<\/span><span class=\"p\">]<\/span><span class=\"o\">=<\/span><span class=\"mi\">20<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">4<\/span><span class=\"p\">]:<\/span> <span class=\"n\">p<\/span><span class=\"p\">.<\/span><span class=\"n\">DF<\/span><span class=\"p\">[<\/span><span class=\"s\">'latitude'<\/span><span class=\"p\">][<\/span><span class=\"mi\">0<\/span><span class=\"p\">]<\/span>\n<span class=\"n\">Out<\/span><span class=\"p\">[<\/span><span class=\"mi\">4<\/span><span class=\"p\">]:<\/span> <span class=\"o\">-<\/span><span class=\"mf\">25.0<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">5<\/span><span class=\"p\">]:<\/span> <span class=\"n\">DF<\/span><span class=\"o\">=<\/span><span class=\"n\">p<\/span><span class=\"p\">.<\/span><span class=\"n\">select<\/span><span class=\"p\">(<\/span><span class=\"s\">'DF'<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">6<\/span><span class=\"p\">]:<\/span> <span class=\"n\">DF<\/span><span class=\"p\">[<\/span><span class=\"s\">'latitude'<\/span><span class=\"p\">][<\/span><span class=\"mi\">0<\/span><span class=\"p\">]<\/span><span class=\"o\">=<\/span><span class=\"mi\">20<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">7<\/span><span class=\"p\">]:<\/span> <span class=\"n\">DF<\/span><span class=\"p\">[<\/span><span class=\"s\">'latitude'<\/span><span class=\"p\">][<\/span><span class=\"mi\">0<\/span><span class=\"p\">]<\/span>\n<span class=\"n\">Out<\/span><span class=\"p\">[<\/span><span class=\"mi\">7<\/span><span class=\"p\">]:<\/span> <span class=\"mf\">20.0<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">8<\/span><span class=\"p\">]:<\/span> <span class=\"n\">p<\/span>                                                                                                                            \n<span class=\"n\">Out<\/span><span class=\"p\">[<\/span><span class=\"mi\">8<\/span><span class=\"p\">]:<\/span>                                                                                                                              \n                                                                                               \n<span class=\"n\">File<\/span> <span class=\"n\">path<\/span><span class=\"p\">:<\/span> <span class=\"o\">\/<\/span><span class=\"n\">path<\/span><span class=\"o\">\/<\/span><span class=\"n\">to<\/span><span class=\"o\">\/<\/span><span class=\"n\">some<\/span><span class=\"o\">\/<\/span><span class=\"n\">hdfstore<\/span><span class=\"p\">.<\/span><span class=\"n\">h5<\/span>                              \n<span class=\"o\">\/<\/span><span class=\"n\">DF<\/span>                <span class=\"n\">frame_table<\/span>  <span class=\"p\">(<\/span><span class=\"n\">typ<\/span><span class=\"o\">-&gt;<\/span><span class=\"n\">appendable<\/span><span class=\"p\">,<\/span><span class=\"n\">nrows<\/span><span class=\"o\">-&gt;<\/span><span class=\"mi\">24165608<\/span><span class=\"p\">,<\/span><span class=\"n\">ncols<\/span><span class=\"o\">-&gt;<\/span><span class=\"mi\">7<\/span><span class=\"p\">,<\/span><span class=\"n\">indexers<\/span><span class=\"o\">-&gt;<\/span><span class=\"p\">[<\/span><span class=\"n\">index<\/span><span class=\"p\">],<\/span><span class=\"n\">dc<\/span><span class=\"o\">-&gt;<\/span><span class=\"p\">[<\/span><span class=\"n\">longitude<\/span><span class=\"p\">,<\/span><span class=\"n\">latitude<\/span><span class=\"p\">,<\/span><span class=\"n\">depth_m<\/span><span class=\"p\">,<\/span><span class=\"n\">abstime<\/span><span class=\"p\">])<\/span>\n<span class=\"o\">\/<\/span><span class=\"n\">PARLOC<\/span>            <span class=\"n\">frame_table<\/span>  <span class=\"p\">(<\/span><span class=\"n\">typ<\/span><span class=\"o\">-&gt;<\/span><span class=\"n\">appendable<\/span><span class=\"p\">,<\/span><span class=\"n\">nrows<\/span><span class=\"o\">-&gt;<\/span><span class=\"mi\">17913<\/span><span class=\"p\">,<\/span><span class=\"n\">ncols<\/span><span class=\"o\">-&gt;<\/span><span class=\"mi\">4<\/span><span class=\"p\">,<\/span><span class=\"n\">indexers<\/span><span class=\"o\">-&gt;<\/span><span class=\"p\">[<\/span><span class=\"n\">index<\/span><span class=\"p\">])<\/span>\n<span class=\"n\">In<\/span> <span class=\"p\">[<\/span><span class=\"mi\">10<\/span><span class=\"p\">]:<\/span> <span class=\"n\">pd<\/span><span class=\"p\">.<\/span><span class=\"n\">__version__<\/span>                                                                                                              \n<span class=\"n\">Out<\/span><span class=\"p\">[<\/span><span class=\"mi\">10<\/span><span class=\"p\">]:<\/span> <span class=\"s\">'0.12.0'<\/span> <\/code><\/pre><\/figure>\n\n<p>Of course, the annoying part is that line four doesn\u2019t throw an error message!<\/p>\n\n\n    <p><a href=\"https:\/\/cbull.info\/python\/gotcha-in-pandas-using-hdfstore-frame_tables\/\">Gotcha in Pandas using HDFStore frame_tables<\/a> was originally published by Christopher Bull at <a href=\"https:\/\/cbull.info\">Christopher Bull<\/a> on January 08, 2014.<\/p>\n  "}]}