-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pmathiot
committed
Nov 20, 2019
1 parent
4118a46
commit bfe38cc
Showing
17 changed files
with
652 additions
and
14 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--cnk_dmn deptht,1 --cnk_dmn time_counter,1 --cnk_dmn x,200 --cnk_dmn y,200 -v (^thetao$)+,(^votemper$),(^so$)+,(^vosaline$)+,(^zos$)+,(^sossheig$)+,(^somxzint1$)+,(^sokaraml$)+ | ||
--cnk_dmn deptht,1 --cnk_dmn time_counter,1 --cnk_dmn x,200 --cnk_dmn y,200 -v (^thetao$)+,(^votemper$),(^so$)+,(^vosaline$)+,(^zos$)+,(^sossheig$)+,(^somxzint1$)+,(^sokaraml$)+,(^hfds$)+,(^sohefldo$)+,(^soicecov$)+ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
#SBATCH --mem=1G | ||
#SBATCH --time=10 | ||
#SBATCH --ntasks=1 | ||
|
||
if [[ $# -ne 4 ]]; then echo 'mk_hfds.bash [CONFIG (eORCA12, eORCA025 ...)] [RUNID (mi-aa000)] [TAG (19991201_20061201_ANN)] [FREQ (1y)]'; exit 1 ; fi | ||
|
||
CONFIG=$1 | ||
RUNID=$2 | ||
TAG=$3 | ||
FREQ=$4 | ||
GRID='T' | ||
|
||
# load path and mask | ||
. param.bash | ||
. ${SCRPATH}/common.bash | ||
|
||
cd $DATPATH/ | ||
|
||
# name | ||
RUN_NAME=${RUNID#*-} | ||
|
||
# download data if needed | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-${GRID} | ||
|
||
# check presence of input file | ||
FILE=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-${GRID}.nc | ||
if [ ! -f $FILE ] ; then echo "$FILE is missing; exit"; echo "E R R O R in : ./mk_hfds.bash $@ (see SLURM/${CONFIG}/${RUNID}/hfds_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
|
||
# make mxl | ||
FILEOUT=GLO_hfds_nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-${GRID}.nc | ||
if [ $CONFIG == 'eORCA025' ] ; then $CDFPATH/cdfmean -f $FILE -v '|sohefldo|hfds|' -p T -minmax -o tmp_$FILEOUT ; fi | ||
|
||
# mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv tmp_$FILEOUT $FILEOUT | ||
else | ||
echo "error when running cdfmean; exit"; echo "E R R O R in : ./mk_hfds.bash $@ (see SLURM/${CONFIG}/${RUNID}/hfds_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi | ||
# |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
#SBATCH --mem=1G | ||
#SBATCH --time=10 | ||
#SBATCH --ntasks=1 | ||
|
||
if [[ $# -ne 4 ]]; then echo 'mk_mht.bash [CONFIG (eORCA12, eORCA025 ...)] [RUNID (mi-aa000)] [TAG (19991201_20061201_ANN)] [FREQ (1y)]'; exit 1 ; fi | ||
|
||
CONFIG=$1 | ||
RUNID=$2 | ||
TAG=$3 | ||
FREQ=$4 | ||
|
||
# load path and mask | ||
. param.bash | ||
. ${SCRPATH}/common.bash | ||
|
||
cd $DATPATH/ | ||
|
||
# name | ||
RUN_NAME=${RUNID#*-} | ||
|
||
# download data if needed | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-V | ||
|
||
# check presence of input file | ||
FILEV=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-V.nc | ||
if [ ! -f $FILEV ] ; then echo "$FILEV is missing; exit"; echo "E R R O R in : ./mk_mht.bash $@ (see SLURM/${CONFIG}/${RUNID}/mht_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
|
||
# make mht | ||
set -x | ||
FILEOUT=nemo_${RUN_NAME}o_${FREQ}_${TAG}_mht.nc | ||
$CDFPATH/cdfmhst -vt $FILEV -vvl -o tmp_$FILEOUT | ||
|
||
# mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv tmp_$FILEOUT $FILEOUT | ||
else | ||
echo "error when running cdfmht; exit"; echo "E R R O R in : ./mk_mht.bash $@ (see SLURM/${CONFIG}/${RUNID}/mht_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi | ||
|
||
# extract only 26.5 | ||
ncks -d y,793,793 $FILEOUT nemo_${RUN_NAME}o_${FREQ}_${TAG}_mht_265.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
#SBATCH --mem=1G | ||
#SBATCH --time=10 | ||
#SBATCH --ntasks=1 | ||
|
||
if [[ $# -ne 4 ]]; then echo 'mk_moc.bash [CONFIG (eORCA12, eORCA025 ...)] [RUNID (mi-aa000)] [TAG (19991201_20061201_ANN)] [FREQ (1y)]'; exit 1 ; fi | ||
|
||
CONFIG=$1 | ||
RUNID=$2 | ||
TAG=$3 | ||
FREQ=$4 | ||
|
||
# load path and mask | ||
. param.bash | ||
. ${SCRPATH}/common.bash | ||
|
||
cd $DATPATH/ | ||
|
||
# name | ||
RUN_NAME=${RUNID#*-} | ||
|
||
# download data if needed | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-V | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-U | ||
|
||
# check presence of input file | ||
FILEV=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-V.nc | ||
FILEU=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-U.nc | ||
FILET=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-T.nc | ||
FILES=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-T.nc | ||
if [ ! -f $FILEV ] ; then echo "$FILEV is missing; exit"; echo "E R R O R in : ./mk_moc.bash $@ (see SLURM/${CONFIG}/${RUNID}/moc_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
if [ ! -f $FILEU ] ; then echo "$FILEU is missing; exit"; echo "E R R O R in : ./mk_moc.bash $@ (see SLURM/${CONFIG}/${RUNID}/moc_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
if [ ! -f $FILET ] ; then echo "$FILET is missing; exit"; echo "E R R O R in : ./mk_moc.bash $@ (see SLURM/${CONFIG}/${RUNID}/moc_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
if [ ! -f $FILES ] ; then echo "$FILES is missing; exit"; echo "E R R O R in : ./mk_moc.bash $@ (see SLURM/${CONFIG}/${RUNID}/moc_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
|
||
# make moc | ||
set -x | ||
FILEOUT=nemo_${RUN_NAME}o_${FREQ}_${TAG}_moc.nc | ||
$CDFPATH/cdfmoc -v $FILEV -u $FILEU -t $FILET -s $FILES -rapid -vvl -o tmp_$FILEOUT | ||
|
||
# mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv rapid_tmp_$FILEOUT rapid_$FILEOUT | ||
else | ||
echo "error when running cdfmoc; exit"; echo "E R R O R in : ./mk_moc.bash $@ (see SLURM/${CONFIG}/${RUNID}/moc_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
#SBATCH --mem=1G | ||
#SBATCH --time=10 | ||
#SBATCH --ntasks=1 | ||
|
||
if [[ $# -ne 4 ]]; then echo 'mk_sie.bash [CONFIG (eORCA12, eORCA025 ...)] [RUNID (mi-aa000)] [TAG (19991201_20061201_ANN)] [FREQ (1y)]'; exit 1 ; fi | ||
|
||
CONFIG=$1 | ||
RUNID=$2 | ||
TAG=$3 | ||
FREQ=$4 | ||
GRID='T' | ||
|
||
# load path and mask | ||
. param.bash | ||
. ${SCRPATH}/common.bash | ||
|
||
cd $DATPATH/ | ||
|
||
# name | ||
RUN_NAME=${RUNID#*-} | ||
|
||
# download data if needed | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-${GRID} | ||
|
||
# check presence of input file | ||
FILE=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-T.nc | ||
if [ ! -f $FILE ] ; then echo "$FILE is missing; exit"; echo "E R R O R in : ./mk_sie.bash $@ (see SLURM/${CONFIG}/${RUNID}/sie_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
|
||
# make sie | ||
FILEOUT=ARC_sie_nemo_${RUN_NAME}o_${FREQ}_${TAG}.nc | ||
if [ $CONFIG == 'eORCA025' ] ; then $CDFPATH/cdficediags -i $FILE -o tmp_$FILEOUT ; fi | ||
|
||
# mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv tmp_$FILEOUT $FILEOUT | ||
else | ||
echo "error when running cdficediags; exit"; echo "E R R O R in : ./mk_sie.bash $@ (see SLURM/${CONFIG}/${RUNID}/sie_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
#SBATCH --mem=1G | ||
#SBATCH --time=10 | ||
#SBATCH --ntasks=1 | ||
|
||
if [[ $# -ne 4 ]]; then echo 'mk_sst.bash [CONFIG (eORCA12, eORCA025 ...)] [RUNID (mi-aa000)] [TAG (19991201_20061201_ANN)] [FREQ (1y)]'; exit 1 ; fi | ||
|
||
CONFIG=$1 | ||
RUNID=$2 | ||
TAG=$3 | ||
FREQ=$4 | ||
GRID='T' | ||
|
||
# load path and mask | ||
. param.bash | ||
. ${SCRPATH}/common.bash | ||
|
||
cd $DATPATH/ | ||
|
||
# name | ||
RUN_NAME=${RUNID#*-} | ||
|
||
# download data if needed | ||
#${SCRPATH}/get_data.bash $RUNID $FREQ $TAG grid-${GRID} | ||
|
||
# check presence of input file | ||
FILE=nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-${GRID}.nc | ||
if [ ! -f $FILE ] ; then echo "$FILE is missing; exit"; echo "E R R O R in : ./mk_sst.bash $@ (see SLURM/${CONFIG}/${RUNID}/sst_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 ; fi | ||
|
||
# make sst | ||
FILEOUT=SO_sst_nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-${GRID}.nc | ||
if [ $CONFIG == 'eORCA025' ] ; then $CDFPATH/cdfmean -f $FILE -v '|thetao|votemper|' -surf -w 0 0 384 510 1 1 -p T -minmax -o tmp_$FILEOUT ; fi | ||
|
||
# mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv tmp_$FILEOUT $FILEOUT | ||
else | ||
echo "error when running cdfmean; exit"; echo "E R R O R in : ./mk_sst.bash $@ (see SLURM/${CONFIG}/${RUNID}/sst_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi | ||
|
||
FILEOUT=NWC_sst_nemo_${RUN_NAME}o_${FREQ}_${TAG}_grid-${GRID}.nc | ||
if [ $CONFIG == 'eORCA025' ] ; then $CDFPATH/cdfmean -f $FILE -surf -v '|thetao|votemper|' -w 950 1020 870 940 1 1 -p T -minmax -o tmp_$FILEOUT ; fi | ||
|
||
#mv output file | ||
if [[ $? -eq 0 ]]; then | ||
mv tmp_$FILEOUT $FILEOUT | ||
else | ||
echo "error when running cdfmean; exit"; echo "E R R O R in : ./mk_sst.bash $@ (see SLURM/${CONFIG}/${RUNID}/sst_${TAG}.out)" >> ${EXEPATH}/ERROR.txt ; exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import matplotlib | ||
import netCDF4 as nc | ||
#matplotlib.use('GTKAgg') | ||
import numpy as np | ||
from numpy import ma | ||
import os | ||
import argparse | ||
import cartopy | ||
import matplotlib.pyplot as plt | ||
import matplotlib as matplotlib | ||
import matplotlib.colors as colors | ||
from matplotlib.colors import Normalize | ||
import cartopy.crs as ccrs | ||
import sys | ||
import re | ||
from cartopy.feature import LAND | ||
|
||
# ============================ plot utility ======================================== | ||
def add_land_features(ax,cfeature_lst): | ||
# get isf groiunding line, ice shelf front and coastline | ||
for ifeat,cfeat in enumerate(cfeature_lst): | ||
if cfeat=='isf': | ||
#feature = cartopy.feature.NaturalEarthFeature('physical', 'antarctic_ice_shelves_polys', '50m',facecolor='0.75',edgecolor='k') # global plot | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'antarctic_ice_shelves_polys', '50m',facecolor='none',edgecolor='k') | ||
elif cfeat=='lakes': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'lakes' , '50m',facecolor='none',edgecolor='k') | ||
elif cfeat=='coast': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'coastline' , '50m',facecolor='0.75',edgecolor='k') | ||
elif cfeat=='land': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'land' , '50m',facecolor='0.75',edgecolor='k') | ||
elif cfeat=='bathy_z1000': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'bathymetry_J_1000' , '10m',facecolor='none',edgecolor='k') | ||
elif cfeat=='bathy_z2000': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'bathymetry_I_2000' , '10m',facecolor='none',edgecolor='k') | ||
elif cfeat=='bathy_z3000': | ||
feature = cartopy.feature.NaturalEarthFeature('physical', 'bathymetry_H_3000' , '10m',facecolor='none',edgecolor='k') | ||
else: | ||
print 'feature unknown : '+cfeat | ||
sys.exit(42) | ||
ax.add_feature(feature,linewidth=0.5) | ||
|
||
class box(object): | ||
def __init__(self,corner,name): | ||
self.xmin=corner[0]-1 | ||
self.xmax=corner[1]-1 | ||
self.ymin=corner[2]-1 | ||
self.ymax=corner[3]-1 | ||
self.name=name | ||
|
||
cfile='/data/cr1/pmathiot/MESH_MASK/bathymetry_eORCA025-GO6.nc' | ||
ncid = nc.Dataset(cfile) | ||
bathy = ncid.variables['Bathymetry'][0:-2,:] | ||
ncid.close() | ||
cfile='/data/cr1/pmathiot/MESH_MASK/mesh_mask_eORCA025-GO6.nc' | ||
ncid = nc.Dataset(cfile) | ||
lon = ncid.variables['nav_lon'][0:-2,:] | ||
lat = ncid.variables['nav_lat'][0:-2,:] | ||
delta_lon=np.abs(np.diff(lon)) | ||
j_lst,i_lst=np.nonzero(delta_lon>180) | ||
print j_lst.shape, i_lst.shape | ||
for idx in range(0,len(j_lst)): | ||
lon[j_lst[idx], i_lst[idx]+1:] += 360 | ||
print lon.shape, lat.shape, bathy.shape | ||
|
||
box_lst=[None]*1 | ||
box_lst[0]=box([950,1020,870,940],'NWC') | ||
|
||
mask=np.zeros(shape=bathy.shape) | ||
for box in box_lst: | ||
mask[box.ymin:box.ymax,box.xmin:box.xmax] = 1.0 | ||
|
||
proj=cartopy.crs.Robinson(); # ccrs.Stereographic(central_latitude=-90.0, central_longitude=0.0) | ||
XY_lim=[-180, 180, -90, 90] | ||
plt.figure(figsize=np.array([210, 210]) / 25.4) | ||
ax=plt.subplot(1, 1, 1, projection=proj, axisbg='0.75') | ||
#ax=plt.subplot(1, 1, 1) | ||
add_land_features(ax,['isf','lakes','land']) | ||
print np.max(bathy), np.min(bathy) | ||
ax.pcolormesh(lon,lat,bathy,cmap='Blues',vmin=0,vmax=7000,transform=ccrs.PlateCarree(),rasterized=True) | ||
|
||
ax.contour(lon,lat,mask,levels=[0.99, 2.0],transform=ccrs.PlateCarree(),colors='k',rasterized=True,linewidths=2) | ||
|
||
# ACC section | ||
ax.plot([lon[420,874], lon[332,899]],[lat[420,874], lat[332,899]],transform=ccrs.PlateCarree(),color='k',linewidth=2,rasterized=True) | ||
ax.text(lon[420,874]+5,lat[420,874]+2,'Drake',transform=ccrs.PlateCarree(),color='k',fontweight='bold',fontsize=16) | ||
|
||
# 26.5 north section | ||
ax.plot([-80.63, -13],[26.5, 26.5],transform=ccrs.PlateCarree(),color='k',linewidth=2,rasterized=True) | ||
box=box_lst[0]; ax.text(-60, 15, '26.5 N',transform=ccrs.PlateCarree(),color='k',fontweight='bold',fontsize=16) | ||
|
||
# SO box | ||
ax.plot([-180, 180],[-60, -60],transform=ccrs.PlateCarree(),color='k',linewidth=2,rasterized=True) | ||
ax.plot([-180, 180],[-40, -40],transform=ccrs.PlateCarree(),color='k',linewidth=2,rasterized=True) | ||
ax.text(0, -55,'SO',transform=ccrs.PlateCarree(),color='k',fontweight='bold',fontsize=16) | ||
|
||
# NWC box | ||
box=box_lst[0]; ax.text(lon[box.ymin+50,box.xmax+50], lat[box.ymin+50,box.xmin+50],box.name,transform=ccrs.PlateCarree(),color='k',fontweight='bold',fontsize=16) | ||
|
||
#pcol=ax.pcolormesh(lon,lat,bathy) | ||
#ax.set_extent(XY_lim, ccrs.PlateCarree()) | ||
plt.savefig('box_VALGLO.png', format='png', dpi=150) | ||
plt.show() | ||
|
Oops, something went wrong.