diff --git a/tools/analysis/EddyKineticEnergy.py b/tools/analysis/EddyKineticEnergy.py index 2f914c8bd0..2015f1d761 100755 --- a/tools/analysis/EddyKineticEnergy.py +++ b/tools/analysis/EddyKineticEnergy.py @@ -8,24 +8,22 @@ try: import argparse except: raise Exception('This version of python is not new enough. python 2.7 or newer is required.') -parser = argparse.ArgumentParser(description='''Script for plotting annual-average SST bias.''') -parser.add_argument('annual_file', type=str, help='''Annually-averaged file contained 3D temp.''') +parser = argparse.ArgumentParser(description='''Script for plotting annual-average eddy kinetic energy.''') +parser.add_argument('annual_file', type=str, help='''Daily file containing ssu,ssv.''') parser.add_argument('-l','--label', type=str, default='', help='''Label to add to the plot.''') parser.add_argument('-o','--outdir', type=str, default='.', help='''Directory in which to place plots.''') parser.add_argument('-g','--gridspec', type=str, - default='/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked', - help='''Directory containing mosaic/grid-spec files (ocean_hgrid.nc and ocean_mask.nc).''') + help='''File containing variables geolon,geolat,wet,area_t. Usually the ocean_static.nc from diag_table.''') cmdLineArgs = parser.parse_args() rootGroup = netCDF4.Dataset( cmdLineArgs.annual_file ) if 'ssu' not in rootGroup.variables: raise Exception('Could not find "ssu" in file "%s"'%(cmdLineArgs.annual_file)) if 'ssv' not in rootGroup.variables: raise Exception('Could not find "ssv" in file "%s"'%(cmdLineArgs.annual_file)) -x = netCDF4.Dataset(cmdLineArgs.gridspec+'/ocean_hgrid.nc').variables['x'][::2,::2] -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)) +x = netCDF4.Dataset(cmdLineArgs.gridspec).variables['geolon'][:,:] +y = netCDF4.Dataset(cmdLineArgs.gridspec).variables['geolat'][:,:] +msk = netCDF4.Dataset(cmdLineArgs.gridspec).variables['wet'][:,:] +area = msk*netCDF4.Dataset(cmdLineArgs.gridspec).variables['area_t'][:,:] #[t,z,y,x] corresponds to axis [0,1,2,3] which can be indexed by [-4,-3,-2,-1] diff --git a/tools/analysis/MOM6_refineDiag.csh b/tools/analysis/MOM6_refineDiag.csh index d3406eb1a3..f9a31ea0ae 100755 --- a/tools/analysis/MOM6_refineDiag.csh +++ b/tools/analysis/MOM6_refineDiag.csh @@ -93,10 +93,13 @@ set script_dir=${out_dir}/mom6/tools/analysis echo '==Run some example annual scripts. These are not reviewed by scientists.' +#log the experiment to the MDBI database +fredb -x $rtsxml -p $platform -t $target -q cobweb -d curator $name + echo '====annual mean Eddy Kinetic Energy======' mkdir -p $out_dir/ocean_${yr1}/EddyKineticEnergy -$script_dir/EddyKineticEnergy.py -g /archive/gold/datasets/OM4_025/mosaic.v20140610.unpacked -o $out_dir/ocean_${yr1}/EddyKineticEnergy -l ${yr1} $yr1.ocean_daily.nc +$script_dir/EddyKineticEnergy.py -g $yr1.ocean_static.nc -o $out_dir/ocean_${yr1}/EddyKineticEnergy -l ${yr1} $yr1.ocean_daily.nc echo " ---------- end yearly analysis ---------- "