Skip to content

Commit

Permalink
Merge branch 'master' into dev_e3t
Browse files Browse the repository at this point in the history
Conflicts:
	src/cdfmoy.f90
  • Loading branch information
molines committed Feb 7, 2017
2 parents f3382fe + 87e0d16 commit 01c1a50
Showing 22 changed files with 5,619 additions and 334 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -9,3 +9,6 @@ make.macro
*.aux
*.idx
*.toc
cdftools.1
*.opod
*.tmp
19 changes: 19 additions & 0 deletions DOC/cdftools.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
h1 {
color: red;
text-align: left;
}

h2 {
color: blue;
}

ul {
list-style-type: disc;
color: red;
}

ul ul li {
list-style-type: circle;
color: blue;
}

4,564 changes: 4,564 additions & 0 deletions DOC/cdftools.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions License/CDFTOOLSCeCILL.txt
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ Contributors (alphabetic order ) :
C.Q. Akuetevi, M. Balmaseda, E. Behrens, F. Castruccio, M. Chekki,
P. Colombo, J. Deshayes, N. Djath, N. Ducousso, C. Dufour, R. Dussin,
N. Ferry, F. Hernandez, M. Juza, A. Lecointre, S. Leroux, G. Mainsant,
P. Mathiot, A. Melet, X. Meunier, G. Moreau, W. Rath, J. Regidor,
M. Scheinert, A.M. Treguier
P. Mathiot, A. Melet, X. Meunier, G. Moreau, N. Merino, W. Rath,
J. Regidor, M. Scheinert, A.M. Treguier

This software is a computer program for analysis of NEMO model output
produced in the frame of the DRAKKAR project. It is designed for the
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
22 changes: 20 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ EXEC = cdfmoy cdfmoyt cdfstd cdfmoy_weighted cdfmoy_freq cdfvT cdfuv\
cdfprofile cdfwhereij cdffindij cdfweight cdfmaxmoc cdfcensus cdfzoom cdfmax cdfprobe cdfinfo \
cdf16bit cdfvita cdfvita-geo cdfconvert cdfflxconv cdfclip cdfsstconv cdfstrconv cdfbathy cdfvar \
cdfisf_fill cdfisf_forcing cdfisf_rnf cdfisf_poolchk \
cdficb_clim cdficb_diags \
cdfcsp cdfcoloc cdfmltmask cdfstatcoord cdfpolymask cdfsmooth cdfmkmask cdfdifmask\
cdfgradT cdfhgradb cdfeddyscale_pass1 cdfeddyscale \
cdfkempemekeepe cdfbci cdfbti cdfnrjcomp cdfcofdis cdfsections cdfnorth_unfold cdfovide cdfmppini\
@@ -494,6 +495,12 @@ cdfisf_rnf: cdfio.o cdfisf_rnf.f90
cdfisf_poolchk: cdfio.o modutils.o cdfisf_poolchk.f90
$(F90) cdfisf_poolchk.f90 -o $(BINDIR)/cdfisf_poolchk cdfio.o modutils.o modcdfnames.o $(FFLAGS)

cdficb_clim: cdfio.o cdficb_clim.f90
$(F90) cdficb_clim.f90 -o $(BINDIR)/cdficb_clim cdfio.o modcdfnames.o $(FFLAGS)

cdficb_diags: cdfio.o cdficb_diags.f90
$(F90) cdficb_diags.f90 -o $(BINDIR)/cdficb_diags cdfio.o modcdfnames.o $(FFLAGS)

cdfovide: cdfio.o cdfovide.f90
$(F90) cdfovide.f90 -o $(BINDIR)/cdfovide cdfio.o modcdfnames.o $(FFLAGS)

@@ -545,16 +552,26 @@ clean:
cleanexe: clean
( cd $(BINDIR) ; \rm -f $(EXEC) )

man: cdftools.1
man: cdftools.1 cdftools.html

cdftools.1: cdftools.opod
pod2man --center "CDFTOOLS / NEMO Documentation" \
--release "SVN Revision $$(LANG=C svn update | grep '^At rev' | awk '{print $$3}' | cut -f 1 -d '.')" \
cdftools.opod > cdftools.1

cdftools.html: cdftools.opod
pod2html --infile=cdftools.opod --outfile=cdftools.html --title="CDFTOOLS Man pages" --css="./cdftools.css"

cdftools.opod: $(EXEC) cdftools-begin.pod cdftools-end.pod
cat cdftools-begin.pod > cdftools.opod
for s in $$( cd $(BINDIR); ls -1 ); do echo ''; echo "=head2 $$s"; echo ''; $$s; done >> cdftools.opod
for s in $$( cd $(BINDIR); ls -1 ); do echo ''; echo "=head2 $$s"; echo ''; $(BINDIR)/$$s; done >> cdftools.opod
echo ' ' >> cdftools.opod
echo "=head1 AUTHORS" >> cdftools.opod
echo ' ' >> cdftools.opod
echo "Project headed by Jean-Marc Molines, (IGE, Grenoble - France)" >> cdftools.opod
echo ' ' >> cdftools.opod
grep -A1000 -i contribu ../License/CDFTOOLSCeCILL.txt | grep -m1 -B1000 ^$$ >> cdftools.opod
echo ' ' >> cdftools.opod
cat cdftools-end.pod >> cdftools.opod

install:
@@ -565,6 +582,7 @@ installman:
@mkdir -p $(INSTALL_MAN)/man1;
\cp -f cdftools.1 $(INSTALL_MAN)/man1/;
for s in $$( cd $(BINDIR); ls -1 ); do ( cd $(INSTALL_MAN)/man1/; ln -sf cdftools.1 $$s.1 ); done;
\cp -f cdftools.html ../DOC/
f2py:
f2py -c --fcompiler=gnu95 -m cdftoolspython cdficediags.f90 cdfio.o modcdfnames.o -I$(EBROOTNETCDFMINFORTRAN)/include -L$(EBROOTNETCDFMINFORTRAN)/lib64 -lnetcdf -lnetcdff

86 changes: 64 additions & 22 deletions src/cdf_xtrac_brokenline.f90
Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@ PROGRAM cdf_xtract_brokenline
INTEGER(KIND=4) :: np_e1vn, np_e3un, np_e3vn ! "
INTEGER(KIND=4) :: np_vmod, np_e1v, np_e3v ! "
INTEGER(KIND=4) :: np_vmsk, np_baro, np_bat ! "
INTEGER(KIND=4) :: np_ssh, np_mld ! "
INTEGER(KIND=4) :: np_icethick, np_icefra ! "
INTEGER(KIND=4) :: np_ssh, np_mld, np_vt, np_vs ! "
INTEGER(KIND=4) :: np_icethick, np_icefra ! "
INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE :: ncout ! Netcdf error and ncid
INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE :: ipk, id_varout ! netcdf output stuff

@@ -82,7 +82,8 @@ PROGRAM cdf_xtract_brokenline
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: temper, saline ! model Temperature and salinity
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: uzonal, vmerid ! model zonal and meridional velocity
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: ssh, rmld ! model SSH and MLD
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: ricethick, ricefra ! ice thickness and fraction
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: ricethick, ricefra ! ice thickness and fraction
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: zvmod ! ice thickness and fraction
! along section array (dimension x,z or x,1 )
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: tempersec, salinesec, uzonalsec, vmeridsec
REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: sshsec, rmldsec
@@ -98,6 +99,7 @@ PROGRAM cdf_xtract_brokenline

CHARACTER(LEN=255) :: cf_tfil , cf_ufil, cf_vfil ! input T U V files
CHARACTER(LEN=255) :: cf_icefil ! input ice file
CHARACTER(LEN=255) :: cf_root='' ! root name used as prefix
CHARACTER(LEN=255) :: cf_out ! output file
CHARACTER(LEN=255) :: cf_secdat ! output section file (suitable for cdftransport or cdfsigtrp)
CHARACTER(LEN=255) :: cverb='n' ! verbose key for findij
@@ -112,6 +114,7 @@ PROGRAM cdf_xtract_brokenline
LOGICAL :: lssh = .FALSE. ! flag for saving ssh
LOGICAL :: lmld = .FALSE. ! flag for saving mld
LOGICAL :: lice = .FALSE. ! flag for saving ice*
LOGICAL :: lvt = .FALSE. ! flag for saving products vt, vs
LOGICAL :: ll_ssh, ll_mld, ll_ice ! working flag for jk =1

TYPE (variable), DIMENSION(:), ALLOCATABLE :: stypvar ! variable definition and attributes
@@ -124,7 +127,8 @@ PROGRAM cdf_xtract_brokenline
narg = iargc()
IF ( narg < 3 ) THEN
PRINT *,' usage : cdf_xtrac_brokenline T-file U-file V-file [ice-file] ....'
PRINT *,' [-f section_filei,sec_file2, ... ] [-verbose] [-ssh ] [-mld] [-ice]'
PRINT *,' [-f section_filei,sec_file2, ... ] [-verbose] [-ssh ] [-mld] [-ice] '
PRINT *,' [-vt] [-o ROOT_name]'
PRINT *,' '
PRINT *,' PURPOSE :'
PRINT *,' This tool extracts model variables from model files for a geographical'
@@ -169,15 +173,22 @@ PROGRAM cdf_xtract_brokenline
PRINT *,' -ssh : also save ssh along the broken line.'
PRINT *,' -mld : also save mld along the broken line.'
PRINT *,' -ice : also save ice properties along the broken line.'
PRINT *,' -vt : also save products vt and vs along the broken line.'
PRINT *,' -o ROOT-name : specified the prefix to be used for the output file name.'
PRINT *,' Note that it may be a good idea to include a separator '
PRINT *,' character such as _ at the end of the ROOT_name.'
PRINT *,' '
PRINT *,' REQUIRED FILES :'
PRINT *,' ', TRIM(cn_fhgr),' and ',TRIM(cn_fzgr),' must be in the current directory '
PRINT *,' ', TRIM(cn_fhgr),' and ',TRIM(cn_fzgr),' in the current directory '
PRINT *,' '
PRINT *,' OUTPUT : '
PRINT *,' netcdf file : section_name.nc'
PRINT *,' netcdf file : <section_name>.nc (default). If -o option is used, the'
PRINT *,' name will be <ROOT-name><section_name>.nc'
PRINT *,' variables : temperature, salinity, normal velocity, pseudo V metrics,'
PRINT *,' mask, barotropic transport, bathymetry of velocity points.'
PRINT *,' ASCII file : section_name_section.dat usefull for cdftransport '
PRINT *,' mask, barotropic transport, bathymetry of velocity points.'
PRINT *,' Additional variables can be set when using options.'
PRINT *,' ASCII file : <section_name>_section.dat usefull for cdftransport, gives'
PRINT *,' the position in I,J of the geographical input points.'
PRINT *,' '
PRINT *,' SEE ALSO :'
PRINT *,' cdftransport, cdfmoc, cdfmocsig. This tool replaces cdfovide.'
@@ -193,7 +204,9 @@ PROGRAM cdf_xtract_brokenline
CASE ( '-verbose' ) ; lverbose=.TRUE. ; cverb='y'
CASE ( '-ssh' ) ; lssh =.TRUE. ; nvar = nvar + 1 !
CASE ( '-mld' ) ; lmld =.TRUE. ; nvar = nvar + 1 !
CASE ( '-ice' ) ; lice =.TRUE. ; nvar = nvar + 1 !
CASE ( '-ice' ) ; lice =.TRUE. ; nvar = nvar + 2 !
CASE ( '-vt ' ) ; lvt =.TRUE. ; nvar = nvar + 2 !
CASE ( '-o ' ) ; CALL getarg(ijarg, cf_root) ; ijarg = ijarg + 1 !
CASE ( '-f' ) ; CALL getarg(ijarg, cldum) ; ijarg = ijarg + 1 ; lsecfile=.TRUE.
CALL ParseFiles(cldum) ! many section files can be given separated with comma
CASE DEFAULT
@@ -370,6 +383,7 @@ PROGRAM cdf_xtract_brokenline
ALLOCATE( batsec (npsecmax-1,1 ), vmasksec (npsecmax-1,npk) )
ALLOCATE( tempersec(npsecmax-1,npk), salinesec(npsecmax-1,npk) )
ALLOCATE( uzonalsec(npsecmax-1,npk), vmeridsec(npsecmax-1,npk) )
ALLOCATE( zvmod (npsecmax-1,1) ) ! working array
IF ( lssh ) ALLOCATE ( sshsec (npsecmax-1,1) )
IF ( lmld ) ALLOCATE ( rmldsec(npsecmax-1,1) )
IF ( lice ) ALLOCATE(ricethicksec(npsecmax-1,1),ricefrasec(npsecmax-1,1))
@@ -402,8 +416,8 @@ PROGRAM cdf_xtract_brokenline

! Loop on section for metrics and non z-depending variables
DO jsec = 1, nsec ! loop on sections
cf_out = TRIM(csection(jsec))//'.nc'
cf_secdat = TRIM(csection(jsec))//'_section.dat'
cf_out = TRIM(cf_root)//TRIM(csection(jsec))//'.nc'
cf_secdat = TRIM(cf_root)//TRIM(csection(jsec))//'_section.dat'

ipoint = 1
DO jleg=1, nsta(jsec) -1 ! loop on legs
@@ -610,17 +624,19 @@ PROGRAM cdf_xtract_brokenline
END DO

! output section variable at level jk, in separated output section files
ierr = putvar (ncout(jsec), id_varout(np_tem), tempersec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_sal), salinesec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_una), uzonalsec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_vna), vmeridsec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_tem), tempersec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_sal), salinesec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_una), uzonalsec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
ierr = putvar (ncout(jsec), id_varout(np_vna), vmeridsec(:,jk), jk, npsec(jsec)-1, 1, ktime=jt )
! along-track normal velocity, horiz. and vert. resolution, and mask
ierr = putvar (ncout(jsec), id_varout(np_vmod),uzonalsec(:,jk) + vmeridsec(:,jk), &
& jk, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ssh) ierr = putvar (ncout(jsec), id_varout(np_ssh), sshsec (:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_mld) ierr = putvar (ncout(jsec), id_varout(np_mld), rmldsec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ice) ierr = putvar (ncout(jsec), id_varout(np_icethick), ricethicksec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ice) ierr = putvar (ncout(jsec), id_varout(np_icefra), ricefrasec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
zvmod(:,1)= uzonalsec(:,jk) + vmeridsec(:,jk)
ierr = putvar (ncout(jsec), id_varout(np_vmod ), zvmod(:,1), jk, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ssh) ierr = putvar (ncout(jsec), id_varout(np_ssh ), sshsec (:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_mld) ierr = putvar (ncout(jsec), id_varout(np_mld ), rmldsec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ice) ierr = putvar (ncout(jsec), id_varout(np_icethick), ricethicksec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (ll_ice) ierr = putvar (ncout(jsec), id_varout(np_icefra ), ricefrasec(:,jk), 1, npsec(jsec)-1, 1, ktime=jt )
IF (lvt ) ierr = putvar (ncout(jsec), id_varout(np_vt ), zvmod(:,1)*tempersec(:,jk),jk, npsec(jsec)-1, 1, ktime=jt )
IF (lvt ) ierr = putvar (ncout(jsec), id_varout(np_vs ), zvmod(:,1)*salinesec(:,jk),jk, npsec(jsec)-1, 1, ktime=jt )

IF ( jt == 1 ) THEN ! output of time independent variables at first time step only
! save a mask of the section
@@ -867,7 +883,8 @@ SUBROUTINE CreateOutputFile(ksec)
stypvar(ivar)%clong_name = 'icethick along '//TRIM(csection(ksec))//' section'
stypvar(ivar)%cshort_name = cn_iicethic
stypvar(ivar)%caxis = 'TX'
ipk(ivar) = 1
ipk(ivar) = 1
ivar = ivar + 1

np_icefra = ivar
stypvar(ivar)%cname = cn_ileadfra
@@ -878,6 +895,31 @@ SUBROUTINE CreateOutputFile(ksec)
stypvar(ivar)%cshort_name = cn_ileadfra
stypvar(ivar)%caxis = 'TX'
ipk(ivar) = 1
ivar = ivar + 1
ENDIF

IF ( lvt ) THEN
np_vt = ivar
stypvar(ivar)%cname = cn_vomevt
stypvar(ivar)%cunits = 'C.m/s'
stypvar(ivar)%valid_min = -1000000.
stypvar(ivar)%valid_max = 1000000.
stypvar(ivar)%clong_name = 'VT product along '//TRIM(csection(ksec))//' section'
stypvar(ivar)%cshort_name = cn_vomevt
stypvar(ivar)%caxis = 'TZX'
ipk(ivar) = npk
ivar = ivar + 1

np_vs = ivar
stypvar(ivar)%cname = cn_vomevs
stypvar(ivar)%cunits = 'PSU.m/s'
stypvar(ivar)%valid_min = -1000000.
stypvar(ivar)%valid_max = 1000000.
stypvar(ivar)%clong_name = 'VS product along '//TRIM(csection(ksec))//' section'
stypvar(ivar)%cshort_name = cn_vomevs
stypvar(ivar)%caxis = 'TZX'
ipk(ivar) = npk
ivar = ivar + 1
ENDIF

! create output fileset
Loading

0 comments on commit 01c1a50

Please sign in to comment.