diff --git a/ice_ocean_SIS/OM4_025/ocn_annual.frepp b/ice_ocean_SIS/OM4_025/ocn_annual.frepp index 1f35a3ebb7..fc4e1725aa 100644 --- a/ice_ocean_SIS/OM4_025/ocn_annual.frepp +++ b/ice_ocean_SIS/OM4_025/ocn_annual.frepp @@ -70,34 +70,38 @@ set target if ($#argv) set argu = ($argv:q) -set freanalysismodule = fre-analysis/test +#set freanalysismodule = fre-analysis/test # make sure valid platform and required modules are loaded if (`gfdl_platform` == "hpcs-csc") then source $MODULESHOME/init/csh module use -a /home/fms/local/modulefiles #/usr/local/paida/Modules module purge - module load $fremodule - module load $freanalysismodule - module load gcc +# module load $fremodule +# module load $freanalysismodule +# module load gcc module load netcdf/4.2 module load python/2.7.3 + module load intel_compilers else echo "ERROR: invalid platform" exit 1 endif # check again? -if (! $?FRE_ANALYSIS_HOME) then - echo "ERROR: environment variable FRE_ANALYSIS_HOME not set." - exit 1 -endif +#if (! $?FRE_ANALYSIS_HOME) then +# echo "ERROR: environment variable FRE_ANALYSIS_HOME not set." +# exit 1 +#endif + +# Build MIDAS libs and set PYTHONPATH +(cd ${out_dir}/mom6/tools/python/025gridGeneration ; make frepp_local ) +setenv PYTHONPATH ${out_dir}/mom6/tools/python/025gridGeneration/local/lib/python # Run script set src_dir = ${out_dir}/mom6/tools/analysis set script_bash = ${src_dir}/MOM6_ts_annual.bash set script_dir = ${out_dir}/mom6/tools/analysis -setenv PYTHONPATH ${out_dir}/mom6/tools/python/025gridGeneration/local/lib/python set woa05=/archive/gold/datasets/OM4_025/obs/WOA05_ptemp_salt_annual.v20141006.nc set mosaicDir=/archive/gold/datasets/OM4_025/mosaic.v20140610.unpacked diff --git a/tools/analysis/EddyKineticEnergy.py b/tools/analysis/EddyKineticEnergy.py index 5fc2122eb3..2f914c8bd0 100755 --- a/tools/analysis/EddyKineticEnergy.py +++ b/tools/analysis/EddyKineticEnergy.py @@ -25,11 +25,12 @@ y = netCDF4.Dataset(cmdLineArgs.gridspec+'/ocean_hgrid.nc').variables['y'][::2,::2] msk = netCDF4.Dataset(cmdLineArgs.gridspec+'/ocean_mask.nc').variables['mask'][:] area = msk*netCDF4.Dataset(cmdLineArgs.gridspec+'/ocean_hgrid.nc').variables['area'][:,:].reshape([msk.shape[0], 2, msk.shape[1], 2]).sum(axis=-3).sum(axis=-1) -msk = numpy.ma.array(msk, mask=(msk==0)) +#msk = numpy.ma.array(msk, mask=(msk==0)) #[t,z,y,x] corresponds to axis [0,1,2,3] which can be indexed by [-4,-3,-2,-1] ssu = rootGroup.variables['ssu'] + ssu_mean = ssu[:].mean(axis=0) eke_u = (0.5*(ssu-ssu_mean)**2).mean(axis=0) eke = (eke_u + numpy.roll(eke_u,1,axis=-1))/2 # U-point to T-point transform @@ -39,10 +40,23 @@ eke_v = (0.5*(ssv-ssv_mean)**2).mean(axis=0) eke = eke + (eke_v + numpy.roll(eke_v,1,axis=-2))/2 -ci=m6plot.pmCI(0.0,0.5,0.1) +#factor of 10000 to convert to (cm/s)^2 +eke = 10000*eke + +#clip the extreme small values that cause log to blow up +eke = eke.clip(min=1.0e-8) + +#Plot with logscale=True +#ci=m6plot.pmCI(0.0,10.0,0.1) +#plot_title = 'Eddy Kinetic Energy annual mean [(cm/s)^2]' + +#The logscale=True of matplotlib.pyplot does not work! +#So, pass the log to be plotted instead +eke = numpy.log(eke) +plot_title = 'Log of Eddy Kinetic Energy annual mean [(cm/s)^2]' -m6plot.xyplot( 10000*eke, x, y, area=area, - suptitle=rootGroup.title+' '+cmdLineArgs.label, title='Eddy Kinetic Energy annual mean [(cm/s)^2]', - clim=ci, logscale=True, +m6plot.xyplot( eke, x, y, area=area, + suptitle=rootGroup.title+' '+cmdLineArgs.label, title=plot_title, +# clim=ci, logscale=True, save=cmdLineArgs.outdir+'/EKE_mean.png') diff --git a/tools/analysis/TS_depth_integrals.py b/tools/analysis/TS_depth_integrals.py old mode 100644 new mode 100755 index d0a634b97e..431ae5093e --- a/tools/analysis/TS_depth_integrals.py +++ b/tools/analysis/TS_depth_integrals.py @@ -6,6 +6,9 @@ from midas.rectgrid import * from midas.rectgrid_gen import * +import matplotlib +# Force matplotlib to not use any Xwindows backend. +matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import netCDF4 as nc