From 2a908e0c5029961d59f687b21f6162b58f2171b1 Mon Sep 17 00:00:00 2001 From: aradhakrishnanGFDL Date: Tue, 30 Jan 2018 15:17:20 -0500 Subject: [PATCH] Delete bw_atmos_atl_pac.csh.1980-2014-Copy4-checkpoint.ipynb --- ...l_pac.csh.1980-2014-Copy4-checkpoint.ipynb | 349 ------------------ 1 file changed, 349 deletions(-) delete mode 100644 analysis/bw/bw_atmos_zm_atl_pac_a1r/.ipynb_checkpoints/bw_atmos_atl_pac.csh.1980-2014-Copy4-checkpoint.ipynb diff --git a/analysis/bw/bw_atmos_zm_atl_pac_a1r/.ipynb_checkpoints/bw_atmos_atl_pac.csh.1980-2014-Copy4-checkpoint.ipynb b/analysis/bw/bw_atmos_zm_atl_pac_a1r/.ipynb_checkpoints/bw_atmos_atl_pac.csh.1980-2014-Copy4-checkpoint.ipynb deleted file mode 100644 index 7cf4ea8..0000000 --- a/analysis/bw/bw_atmos_zm_atl_pac_a1r/.ipynb_checkpoints/bw_atmos_atl_pac.csh.1980-2014-Copy4-checkpoint.ipynb +++ /dev/null @@ -1,349 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##### Analysis results using: bw_atmos_zm_atl_pac/run_zm_atl_pac.pl\n", - "This script plots the zonal mean zonal wind stress over the ocean for\n", - "the Atlantic and Pacific basins.\n", - "\n", - "Original author: Bruce Wyman, GFDL. \n", - "To use this notebook, please ensure the Input parameters are set and run it in your jupyter notebook environment with all the dependencies installed from this gir repository. " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## GFDL has a module environment set up to load Flexible Runtime Environment. The following environment variables will allow a user to run this analysis script contained within the git repo without explicit \"module load\". But, the user is expected to copy the directories referenced in the following from the git repo. Also, we will set up an alias to gcp commands. GCP is a GFDL home-grown smart data transfer utility. For public facing scripts, it is enough that the user uses \"cp\" or other copy tools relevant to their runtime environment." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "import os\n", - "os.environ['FRE_ANALYSIS_GIT_URL']= 'file:///home/fms/local/opt/fre-analysis/git'\n", - "os.environ['PATH']+= os.pathsep +os.environ['FRE_ANALYSIS_GIT_URL']\n", - "os.environ['NCARG'] = '/usr/local/x64/ncarg-6.2.1/bin/' #/usr/local/x64/ncarg-6.2.1/bin'\n", - "os.environ['PATH']+= os.pathsep + os.environ['NCARG']\n", - "os.environ['NCO'] = '/usr/local/x64/nco-4.0.3/bin'\n", - "os.environ['PATH']+= os.pathsep + os.environ['NCO']\n", - "os.environ['NETCDF'] = '/usr/local/x64/netcdf-4.2_optimized/bin/'\n", - "os.environ['PATH']+= os.pathsep + os.environ['NETCDF']\n", - "os.environ['TMPDIR'] = \"/tmp/a1r/v4\"\n", - "os.environ['LD_LIBRARY_PATH'] = '/usr/local/x64/nco-4.3.1/lib'\n", - "os.environ['LD_LIBRARY_PATH'] += os.pathsep + '/usr/local/x64/netcdf-4.2_optimized/lib:/usr/local/x64/hdf5-1.8.8_optimized/lib:/usr/local/x64/intel/Compiler/11.1/073/lib/intel64'\n", - "os.environ['CPATH'] ='/usr/local/x64/ncarg-6.2.1/include'\n", - "os.environ['LIBRARY_PATH']='/usr/local/x64/ncarg-6.2.1/lib'\n", - "os.environ['NCARG_ROOT']='/usr/local/x64/ncarg-6.2.1'\n", - "os.environ['_LMFILES_']='/usr/local/Modules/x64/modulefiles/ncarg/6.2.1'\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "# %load /nbhome/a1r/bw/runbw.py\n", - "#!/usr/bin/python\n", - "############## load modules #####################\n", - "import subprocess,commands,os,sys\n", - "from subprocess import PIPE\n", - "from git import Repo\n", - "\n", - "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", - "# Original Script: bw_atmos_zm_atl_pac.csh\n", - "# Original Author: Bruce Wyman\n", - "# Source data: pp/atmos/av/monthly_Xyr\n", - "# Output: Creates figures in $out_dir/atmos_${yr1}_${yr2}\n", - "#\n", - "# Sample frepp usage (http://www.gfdl.noaa.gov/fms/fre/#analysis):\n", - "# \n", - "# \n", - "# \n", - "# \n", - "# \n", - "####INPUT PARAMETERS######\n", - "in_data_dir = '/archive/Huan.Guo/awg/warsaw/c96L33_am4p0_cmip6Diag/gfdl.ncrc4-intel-prod-openmp/pp/atmos_cmip/av/monthly_35yr/'\n", - "in_data_file = 'atmos_cmip.1980-2014.{01,02,03,04,05,06,07,08,09,10,11,12}.nc'\n", - "descriptor = 'AM4.0'#c96L33_am4p0_cmip6Diag'\n", - "out_dir= '/nbhome/a1r/bw/output/bw_atmos_atl_pac.csh.1980-2014/v0807/' \n", - "yr1 = '1980'\n", - "yr2 = '2014'\n", - "#remove thisupon testing fremodule = \"fre/bronx-12\"\n", - "#remove this upon testing freanalysismodule = \"fre-analysis/test\"\n", - "BASEDIR=\"/home/a1r/ipy/Notebooks/Documentations/AM4Documentation/bw/bw_atmos_cru_ts\"\n", - "########### end of analysis template variables #######\n", - "platform = 'desktop' \n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false, - "scrolled": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running script on non-GFDL machine and public repo: skip module load\n", - "/home/a1r/ipy/Notebooks/Documentations/AM4Documentation/bw/bw_atmos_cru_ts/fre-analysis/bw_atmos_zm_atl_pac/run_zm_atl_pac_public.pl -v tauu -i /archive/Huan.Guo/awg/warsaw/c96L33_am4p0_cmip6Diag/gfdl.ncrc4-intel-prod-openmp/pp/atmos_cmip/av/monthly_35yr/ -d AM4.0 -y 1980,2014 -o /nbhome/a1r/bw/output/bw_atmos_atl_pac.csh.1980-2014/v0807/ atmos_cmip.1980-2014.{01,02,03,04,05,06,07,08,09,10,11,12}.nc\n", - "For variable \"tauu\" there were \"27\" local CMIP5 climo files found.\n", - "#--- Running Plotting Routines ---\n", - "ncl yr1=1979 yr2=2008 'model_descriptor=\"AM4.0 (1980-2014)\"' 'psfile=\"tauu_atl_pac.ps\"' 'variable=\"tauu\"' /home/a1r/ipy/Notebooks/Documentations/AM4Documentation/bw/bw_atmos_cru_ts/fre-analysis/bw_atmos_zm_atl_pac/ncl/plot_zonal_clim.ncl\n", - " Copyright (C) 1995-2014 - All Rights Reserved\n", - " University Corporation for Atmospheric Research\n", - " NCAR Command Language Version 6.2.1\n", - " The use of this software is governed by a License Agreement.\n", - " See http://www.ncl.ucar.edu/ for more details.\n", - "(0)\tdefining CMIP5GRID@pacific\n", - "(0)\tdefining CMIP5DATA@pacific\n", - "(0)\tdefining CMIP5GRID@atlantic\n", - "(0)\tdefining CMIP5DATA@atlantic\n", - "(0)\tdefining CMIP5GRID@global\n", - "(0)\tdefining CMIP5DATA@global\n", - "(0)\tModel: ACCESS1-0\n", - "(0)\tModel: bcc-csm1-1\n", - "(0)\tModel: bcc-csm1-1-m\n", - "(0)\tModel: BNU-ESM\n", - "(0)\tModel: CanAM4\n", - "(0)\tModel: CCSM4\n", - "(0)\tModel: CNRM-CM5\n", - "(0)\tModel: CSIRO-Mk3-6-0\n", - "(0)\tModel: FGOALS-g2\n", - "(0)\tModel: FGOALS-s2\n", - "(0)\tModel: GFDL-CM3\n", - "(0)\tModel: GFDL-HIRAM-C180\n", - "fatal:NclOneDValGetRangeIndex: Non-monotonic coordinate value being used, can't complete coordinate subscript\n", - "fatal:Could not obtain coordinate indexes, unable to perform subscript\n", - "fatal:[\"Execute.c\":8578]:Execute: Error occurred at or near line 110 in file $BW_PACKAGE_ROOT/ncl/shared.ncl\n", - "\n", - "fatal:[\"Execute.c\":8578]:Execute: Error occurred at or near line 204 in file /home/a1r/ipy/Notebooks/Documentations/AM4Documentation/bw/bw_atmos_cru_ts/fre-analysis/bw_atmos_zm_atl_pac/ncl/plot_zonal_clim.ncl\n", - "\n", - "/home/a1r/ipy/Notebooks/Documentations/AM4Documentation/bw/bw_atmos_cru_ts/fre-analysis/bw_atmos_zm_atl_pac/shared/bw/addpagelabels.pl -O -l ANN,DJF,MAM,JJA,SON tauu_atl_pac.ps\n", - "--- Saving Postscript File ---\n", - "gzip tauu_atl_pac.ps\n", - "gcp -cd tauu_atl_pac.ps.gz gfdl:/nbhome/a1r/bw/output/bw_atmos_atl_pac.csh.1980-2014/v0807//atmos_1980_2014/Wyman.tauu_atl_pac/\n", - "Error: local stat of path '/tmp/a1r/v4/bw_tauu_atl_pac/tauu_atl_pac.ps.gz' failed, No such file or directory. Cannot continue.\n", - "gzip: tauu_atl_pac.ps: No such file or directory\n", - "\n" - ] - } - ], - "source": [ - "####### load modules ###########\n", - "TMPDIR = os.environ[\"TMPDIR\"]\n", - "if not os.path.exists(TMPDIR):\n", - " os.makedirs(TMPDIR)\n", - " \n", - "if ( platform == 'hpcs-csc' ) or ( platform == 'desktop'):\n", - " print(\"Running script on non-GFDL machine and public repo: skip module load\") \n", - "else:\n", - " print \"ERROR: invalid platform: %s\" % platform\n", - " exit(1)\n", - "\n", - "#---- Check if environment loaded correctly ---#\n", - "\n", - "# \n", - "try: \n", - " os.environ[\"FRE_ANALYSIS_GIT_URL\"]\n", - "except KeyError: \n", - " sys.exit(\"ERROR: environment variable FRE_ANALYSIS_GIT_URL not set.Check module loads\")\n", - "\n", - "# clone the source code from the repository if it does not exist\n", - "\n", - "GIT_REPOSITORY = os.environ.get('FRE_ANALYSIS_GIT_URL')+\"/bw\"\n", - "FRE_CODE_TAG = 'awg_v20170106'\n", - "PACKAGE_NAME = 'bw_atmos_zm_atl_pac'\n", - "FRE_CODE_BASE = BASEDIR+'/fre-analysis'\n", - "\n", - "directory = FRE_CODE_BASE+\"/\"+PACKAGE_NAME \n", - "if not os.path.exists(directory):\n", - " if not os.path.exists(FRE_CODE_BASE):\n", - " os.makedirs(FRE_CODE_BASE)\n", - "\n", - " os.chdir(FRE_CODE_BASE)\n", - "\n", - " repo = Repo.clone_from(GIT_REPOSITORY+\"/\"+PACKAGE_NAME+\".git\",directory,branch=FRE_CODE_TAG)\n", - "##################\n", - "# run the script\n", - "##################\n", - "\n", - "fields = \"(tauu pr curl)\" # plot all fields by default\n", - "\n", - "options = \"-i \"+in_data_dir+\" -d \"+descriptor+\" -y \"+yr1+\",\"+yr2+\" -o \"+out_dir\n", - "\n", - "command = FRE_CODE_BASE+\"/\"+PACKAGE_NAME+\"/run_zm_atl_pac_public.pl -v tauu \"+options+\" \"+in_data_file\n", - "\n", - "print(command)\n", - "\n", - "cmd = subprocess.Popen('tcsh -c \"'+command+'\"',shell=True,stdout=PIPE,stdin=PIPE, stderr=PIPE)\n", - "output, errors = cmd.communicate()\n", - "print output, errors " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "###### Output Figures are found in: /home/a1r/git/bw_analysis/output/bw_atmos_atl_pac.csh.1980-2014/" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "UNCOMPRESS AND DISPLAY FIGURES" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "out_dir= '/nbhome/a1r/bw/output/bw_atmos_atl_pac.csh.1980-2014/v0/' \n", - "\n", - "from IPython.display import Image\n", - "from IPython.display import display\n", - "\n", - "import gzip,os,sys\n", - "path2file=out_dir\n", - "for root, dirs, files in os.walk(out_dir):\n", - " path = root.split(os.sep)\n", - " path2file = path2file+os.path.basename(root)+\"/\"\n", - " for fl in files:\n", - " if(fl.endswith(\".ps.gz\")):\n", - " with gzip.open(path2file+fl, 'rb') as f:\n", - " file_content = f.read()\n", - " f.close()\n", - " fname = fl[:-3]\n", - " fname2 = fl[:-6]\n", - " uncompressed_path = os.path.join(path2file, fname)\n", - " open(uncompressed_path, 'w').write(file_content )\n", - " cmd = 'convert %s %s/%s.png'%( uncompressed_path,path2file,fname2)\n", - " os.system(cmd)\n", - " for root, dirs, filepng in os.walk(path2file):\n", - " for f in filepng:\n", - " if(f.endswith(\".png\")):\n", - " display(Image(path2file+\"/\"+f)) #path2file+fname2+\"-0.png\"\n", - " \n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.7.12 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:42:40) \n", - "[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]\n" - ] - } - ], - "source": [ - "import sys\n", - "print(sys.version)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python [Root]", - "language": "python", - "name": "Python [Root]" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}