This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if paper_case=='20170113_EACnowClimateChange01': | |
section_description_dict=collections.OrderedDict() | |
section_description_dict['AB']=[ 60, 61,217,226,0,54,'zonal' ] | |
section_description_dict['BC']=[ 60, 61,226,303,0,54,'zonal' ] | |
section_description_dict['GD']=[ 85,128,311,312,0,54,'meridional' ] | |
section_description_dict['FE']=[127,128,239,247,0,54,'zonal' ] | |
section_description_dict['ED']=[127,128,247,311,0,54,'zonal' ] | |
section_description_dict['IH']=[ 46,58 ,212,213,0,54,'meridional' ] | |
section_description_dict['JK']=[ 85,86 ,224,231,0,54,'zonal' ] | |
section_description_dict['PQ']=[ 68,80 ,212,213,0,54,'meridional' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lg.info("") | |
lg.info("Running check to see if changes found in "+cfgf+" are now in: "+ofile) | |
#run quick check to make sure all diff'd parameters were inserted | |
#(still uses f90nml, so not exactly independent) | |
with open(ofile) as nml_file: | |
new_nml = f90nml.read(nml_file) | |
for top_key in diff[cfgf].keys(): | |
for bot_key in diff[cfgf][top_key].keys(): | |
# assert(new_nml[top_key][bot_key]==diff[cfgf][top_key][bot_key]),ofile + " did not get created correctly" | |
# print(top_key,bot_key,new_nml[top_key][bot_key],diff[cfgf][top_key][bot_key]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hacked up from: http://www.trondkristiansen.com/?page_id=846 | |
import os | |
from netCDF4 import Dataset | |
import matplotlib.pyplot as plt | |
import matplotlib.cm | |
import numpy as np | |
def LevelColormap(levels, cmap=None): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vimnci() | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: vimnci PATH_TO." | |
echo "Purpose: Allows remote editing of files on nci servers..." | |
echo " " | |
echo "Mandatory arguments: " | |
echo "path or file: vim will either edit or open file passed" | |
echo " " | |
echo "Example." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet cdo | |
########################################################################### | |
# CDO # | |
########################################################################### | |
#extract a time | |
cdo seltimestep,1,2,5 cordex24_CURLFX-FLUXFCE_3h_20040101_20041231_grid_U_2D.nc test.nc | |
#do simple arithmatic | |
cdo expr,'sum=qsr+qns-qt' cordex24_CURLFX-FLUXFCE_3h_19980101_19981231_grid_T_2D.nc ofile.nc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
import matplotlib.pyplot as plt | |
#nb requires latex installed on the machine, see http://matplotlib.org/users/usetex.html | |
from matplotlib import rc | |
import numpy as np | |
rc('text', usetex=True) | |
matplotlib.rcParams['mathtext.fontset'] = 'custom' | |
matplotlib.rcParams['mathtext.rm'] = 'Bitstream Vera Sans' | |
matplotlib.rcParams['mathtext.it'] = 'Bitstream Vera Sans:italic' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Combine multiple images into one. | |
# | |
# To install the Pillow module on Mac OS X: | |
# | |
# $ xcode-select --install | |
# $ brew install libtiff libjpeg webp little-cms2 | |
# $ pip install Pillow | |
# | |
from __future__ import print_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadnc() #load netcdf file in python | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: loadnc FILENAME_PATHNAME" | |
echo "Purpose: loads path of file into ipython (creates loadvar.py in your current dir). Prints file info and available variables. 'ifile' is name of netCDF4 object." | |
echo " " | |
echo "Requires: python netCDF4" | |
echo " " | |
echo "Mandatory arguments: " | |
echo "FILENAME_PATHNAME: path to netCDF file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function servername_push() | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: servername_push PATH_FROM PATH TO." | |
echo "Purpose: rsync function to push files to servername." | |
echo " " | |
echo "Mandatory arguments: " | |
echo "PATH_FROM: Path on local to Rsync from" | |
echo "PATH_TO: Path on server to Rsync to" | |
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function servername_pull() | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: servername_pull PATH_FROM PATH_TO." | |
echo "Purpose: rsync function to pull files from servername." | |
echo " " | |
echo "Mandatory arguments: " | |
echo "PATH_FROM: Path on server to Rsync from" | |
echo "PATH_TO: Path on local to Rsync to" | |
echo " " |
NewerOlder