├── Example4D ├── qflist ├── yearlist ├── datasource ├── varlist ├── monthlist ├── input │ ├── contour.depth │ ├── topo.grd │ ├── cutNCDF.cont │ ├── TopoInfo.dat │ ├── Stabinfo │ ├── general_info │ ├── NCDFinfo_salinity │ ├── NCDFinfo_temperature │ ├── NCDFinfo │ └── param.par ├── blacksea_data_CTD.txt └── driver ├── JRA4 └── Climatology │ ├── monthlist │ ├── yearlist │ ├── qflist │ ├── varlist │ ├── input │ ├── contour.depth │ ├── cutNCDF.cont │ ├── radiusweighting.par │ ├── Stabinfo │ ├── general_info │ ├── NCDFinfo_salinity │ ├── NCDFinfo_temperature │ ├── NCDFinfo │ ├── 3Dinfosalinity │ ├── 3Dinfotemper │ └── SDN_L56.list │ ├── datasource │ ├── plotboundingbox.dat.example │ ├── constandrefe │ ├── Salinity.SDNconv │ ├── Temperature.SDNconv │ ├── specialdataonly │ ├── driver │ ├── emobath2ghertopo │ ├── godiva │ ├── gebcoprep.example │ ├── divaduplicatesODV4 │ ├── gebcomodif │ ├── divacutNCDF │ ├── divaguessformsODV4 │ ├── diva4Dclean │ ├── divaweighting │ └── dvtxtmetainfo ├── DIVA3D ├── divastripped │ ├── gnuwork │ │ ├── threshold.dat.example │ │ ├── dverrorrange │ │ ├── longref.dat.default │ │ ├── longref.dat.example │ │ ├── dvanalysisrange │ │ ├── dvcoastlineheader │ │ ├── diva_coastlinefilled │ │ ├── diva_UV │ │ ├── analysis.pal │ │ ├── analysis.pal.default │ │ ├── diva_trends_1 │ │ ├── diva_trends_2 │ │ ├── diva_trends_3 │ │ ├── diva_trends_4 │ │ ├── diva_trends_5 │ │ ├── diva_analysis_data │ │ ├── error.pal.default │ │ ├── diva_RL │ │ ├── diva_UV_coast │ │ ├── diva_coastline │ │ ├── diva_RL_coast │ │ ├── diva_analysis │ │ ├── diva_DATABINS_coast │ │ ├── diva_error │ │ ├── diva_analysis_log │ │ ├── diva_mesh │ │ ├── diva_std │ │ ├── diva_DATABINS_coast_log │ │ ├── diva_mesh_numbered │ │ ├── diva_mesh_projection │ │ ├── analysis.pal.globalsalinity │ │ ├── diva_analysis_masked │ │ ├── diva_data │ │ ├── diva_analysis_points │ │ ├── diva_analysis_projection │ │ ├── diva_RL_coast_points │ │ ├── diva_analysis_mesh │ │ ├── diva_error_data │ │ ├── diva_data_coast_outliers │ │ ├── diva_data_mesh │ │ ├── diva_error_projection │ │ ├── diva_data_coast │ │ ├── diva_analysis_kml │ │ ├── diva_error_points │ │ ├── diva_covafit │ │ └── dvcoastlinetailer │ ├── divaseminorm │ ├── dvouttoin │ ├── divaqc │ ├── awkfilter │ ├── divadress │ ├── dvmakelog │ ├── dvncmask2RL │ ├── dvintegral │ ├── dvrtimesx │ ├── ncdf2gher │ ├── gher2ncdf │ ├── dv3Dtrans │ ├── diva4Dncwrite │ ├── dv3Ddoqcfiles │ ├── dvdataclean │ ├── dvgebcomodif │ ├── dvtsdwrt │ ├── dvdetrend │ ├── crossval │ ├── dvnil │ ├── dvsample │ ├── divacont2grid │ ├── dvstbdat │ ├── dv3d2stb │ ├── dvgetpar │ ├── divacoa2cont │ ├── divaclean │ ├── dvicemask │ ├── dv4DncYRwrt │ ├── dvoutlierclean │ ├── dvstbchp │ ├── divatest0 │ ├── dvdetreref │ ├── testdivafit │ ├── divatest2 │ ├── dbdb2diva │ ├── divarefe │ ├── divatestint │ ├── dv3Ddatamix │ ├── divabestguess │ ├── dvchpar │ ├── divalogging │ └── test_calc_speed └── src │ └── Fortran │ ├── .gitignore │ ├── Calc │ ├── divapre.h │ ├── modifs │ ├── covar.f │ ├── Makefile │ ├── findca.f │ ├── uur.f │ ├── kernelbis.inc │ ├── mathpr.f │ ├── kernel.inc │ ├── bcondi.f │ ├── allody.f │ └── ureadc.f │ ├── Stabil │ ├── divapre.h │ ├── boundval.F │ ├── wgcvfile.F │ ├── userfunc.F │ ├── tomvec.f │ ├── wclfile.F │ ├── wsnfile.F │ ├── gebprep.F │ ├── N2brunt.F │ ├── potmp.F │ ├── brunt.F │ ├── ureadc.F │ └── refebintrans.F │ ├── Mesh │ ├── iodv.h │ ├── generoptref.f │ └── Makefile │ ├── Util │ ├── .fitlsn.f.swp │ ├── inversecont.f │ ├── bintoasc.f │ ├── forgnuplotcoast.f │ ├── sumup.f │ ├── cverror.f │ ├── Makefile │ ├── calcest.f │ ├── calcestbis.f │ ├── cvtotalerror.f │ ├── calcmuc.f │ ├── datadiff.f │ ├── cverroraii.f │ ├── forgnuplotmeshl.f │ ├── datacheck.f │ ├── forgnuplotmesh.f │ ├── calcmu.f │ ├── lincom.f │ ├── addgridc.f │ ├── sumgridc.f │ ├── sumgrid.f │ ├── filtercv.f │ ├── topoprep.f │ └── subsampling.f │ ├── NC │ ├── netcdfoutputfield.f │ ├── Makefile │ └── netcdfobsid.F90 │ ├── Pipetest │ ├── Makefile │ └── pipetest │ ├── readme │ ├── Extensions │ ├── Makefile │ ├── addc.f │ ├── sumc.f │ ├── sum.f │ ├── ureadc.f │ └── uwritc.f │ ├── README.md │ ├── divacompile_options │ └── Makefile ├── .gitignore ├── .travis.yml └── .github └── workflows └── github-actions-demo.yml /Example4D/qflist: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | -------------------------------------------------------------------------------- /Example4D/yearlist: -------------------------------------------------------------------------------- 1 | 19002009 2 | -------------------------------------------------------------------------------- /JRA4/Climatology/monthlist: -------------------------------------------------------------------------------- 1 | 0101 2 | -------------------------------------------------------------------------------- /JRA4/Climatology/yearlist: -------------------------------------------------------------------------------- 1 | 19752005 2 | -------------------------------------------------------------------------------- /JRA4/Climatology/qflist: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | 7 4 | -------------------------------------------------------------------------------- /Example4D/datasource: -------------------------------------------------------------------------------- 1 | ./blacksea_data_CTD.txt 2 | -------------------------------------------------------------------------------- /Example4D/varlist: -------------------------------------------------------------------------------- 1 | Temperature 2 | Salinity 3 | -------------------------------------------------------------------------------- /Example4D/monthlist: -------------------------------------------------------------------------------- 1 | 0101 2 | 0202 3 | 0303 4 | 5 | -------------------------------------------------------------------------------- /JRA4/Climatology/varlist: -------------------------------------------------------------------------------- 1 | Temperature 2 | Salinity 3 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/threshold.dat.example: -------------------------------------------------------------------------------- 1 | 0.02 2 | -------------------------------------------------------------------------------- /Example4D/input/contour.depth: -------------------------------------------------------------------------------- 1 | 30 2 | 20 3 | 10 4 | 0 5 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/dverrorrange: -------------------------------------------------------------------------------- 1 | set cbrange[0:1] 2 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/.gitignore: -------------------------------------------------------------------------------- 1 | */*.mod 2 | */*.o 3 | */*.a 4 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/contour.depth: -------------------------------------------------------------------------------- 1 | 30 2 | 20 3 | 10 4 | 0 5 | -------------------------------------------------------------------------------- /JRA4/Climatology/datasource: -------------------------------------------------------------------------------- 1 | data_from_New_ODV4_CollectionWOA.txt 2 | -------------------------------------------------------------------------------- /JRA4/Climatology/plotboundingbox.dat.example: -------------------------------------------------------------------------------- 1 | -10 20 2 | 40 50 3 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/longref.dat.default: -------------------------------------------------------------------------------- 1 | longref= 34.40000 2 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/longref.dat.example: -------------------------------------------------------------------------------- 1 | longref= -0.201400042 2 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/divapre.h: -------------------------------------------------------------------------------- 1 | implicit real*8 (a-h,o-z) 2 | 3 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/divapre.h: -------------------------------------------------------------------------------- 1 | implicit real*8 (a-h,o-z) 2 | 3 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Mesh/iodv.h: -------------------------------------------------------------------------------- 1 | integer iodv 2 | parameter(iodv=0) 3 | -------------------------------------------------------------------------------- /Example4D/input/topo.grd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/Example4D/input/topo.grd -------------------------------------------------------------------------------- /Example4D/input/cutNCDF.cont: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 33.00 40.00 4 | 33.00 48.00 5 | 45.00 48.00 6 | 45.00 40.00 7 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/modifs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/Calc/modifs -------------------------------------------------------------------------------- /JRA4/Climatology/input/cutNCDF.cont: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 33.00 40.00 4 | 33.00 48.00 5 | 45.00 48.00 6 | 45.00 40.00 7 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/covar.f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/Calc/covar.f -------------------------------------------------------------------------------- /Example4D/blacksea_data_CTD.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/Example4D/blacksea_data_CTD.txt -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Mesh/generoptref.f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/Mesh/generoptref.f -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/.fitlsn.f.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/Util/.fitlsn.f.swp -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/inversecont.f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/Util/inversecont.f -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/NC/netcdfoutputfield.f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gher-uliege/DIVA/HEAD/DIVA3D/src/Fortran/NC/netcdfoutputfield.f -------------------------------------------------------------------------------- /Example4D/input/TopoInfo.dat: -------------------------------------------------------------------------------- 1 | 27.00000 2 | 40.00000 3 | 1.6666668E-02 4 | 1.6666668E-02 5 | 901 6 | 481 7 | -------------------------------------------------------------------------------- /JRA4/Climatology/constandrefe: -------------------------------------------------------------------------------- 1 | # advection flag 2 | 0 3 | # reference field flag 4 | 0 5 | # vriable year code 6 | 19951995 7 | # variable month code 8 | 0810 9 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divaseminorm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo =============== 3 | echo Semi-normed reference field 4 | echo =============== 5 | divarefe 6 | divaanom 7 | divacalc 8 | divasumup -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/dvanalysisrange: -------------------------------------------------------------------------------- 1 | set cbrange[ 2952.357 : 3469.030 ] 2 | set xrange[ 27.00000 : 42.00000 ] 3 | set yrange[ 40.00000 : 48.00000 ] 4 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvouttoin: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | # assumes data.dat has four columns 4 | paste ./output/fieldatdatapoint.anl ./input/data.dat | awk '{print $4,$5,$3,$7}' > ./input/data.dat -------------------------------------------------------------------------------- /JRA4/Climatology/input/radiusweighting.par: -------------------------------------------------------------------------------- 1 | # characteristic length of weighting (same units as data) [not too low, otherwise memory problems can occur] 2 | 0.01 3 | # characteristic time of weighting (days) 4 | 2 5 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/dvcoastlineheader: -------------------------------------------------------------------------------- 1 | unset pm3d 2 | set style line 2 linetype 1 lw 2 linecolor rgb "dark-gray" 3 | set style line 1 linetype 1 lw 2 linecolor rgb "dark-blue" 4 | 5 | set title 'DIVA contours' 6 | 7 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/bintoasc.f: -------------------------------------------------------------------------------- 1 | real *8 x,y,v 2 | open (61,file='divapipe',form='unformatted') 3 | 1 continue 4 | read(61,end=2) x,y,v 5 | write(6,*) x,y,v 6 | goto 1 7 | 2 stop 8 | end 9 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/forgnuplotcoast.f: -------------------------------------------------------------------------------- 1 | read(66,*) NC 2 | do i=1,NC 3 | read(66,*) NP 4 | do j=1,NP 5 | read(66,*) x,y 6 | write(67,*) x,y 7 | enddo 8 | write(67,*) 9 | write(67,*) 10 | enddo 11 | stop 12 | end 13 | 14 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/Stabinfo: -------------------------------------------------------------------------------- 1 | ! Code name for salinity 2 | Salinity 3 | ! Code name for temperature 4 | Temperature 5 | ! Relative Error 1 (epsilon1): 6 | 0.2 7 | ! Relative Error 2 (epsilon2): 8 | 0.3 9 | ! Relative width fooprint: 10 | 2. 11 | ! Variational-Mixing combination factor: 12 | 1. 13 | ! Maximum iteration permited for each level: 14 | 5 15 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divaqc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ////////////////////////////////////////////////// 3 | echo Looking for outliers 4 | echo ////////////////////////////////////////////////// 5 | echo ' ' 6 | divacalc qc 7 | dvvariance 1 8 | echo ' ' 9 | echo -------------------------- 10 | echo Outlier detection finished 11 | echo -------------------------- -------------------------------------------------------------------------------- /DIVA3D/divastripped/awkfilter: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | awk '{ sum += $1; L[n++] = $1 } 4 | END { 5 | for (j=1;j<3;j++){ 6 | for (i=1; i> bidon 6 | cat dvcoastlinetailer >> bidon 7 | echo gnuplot is $gplot 8 | awk '{print $0 >> "bidon"}' << EOF 9 | #the gnuplot commands 10 | unset pm3d 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_UV: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.55 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot 'fort.55' using 1:2:3:4 with vectors head filled lt 3 t 'Velocity field' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi 20 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/analysis.pal: -------------------------------------------------------------------------------- 1 | set palette defined ( 0 '#000090',\ 2 | 1 '#000fff',\ 3 | 2 '#0090ff',\ 4 | 3 '#0fffee',\ 5 | 4 '#90ff70',\ 6 | 5 '#ffee00',\ 7 | 6 '#ff7000',\ 8 | 7 '#ee0000',\ 9 | 8 '#7f0000') 10 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/analysis.pal.default: -------------------------------------------------------------------------------- 1 | set palette defined ( 0 '#000090',\ 2 | 1 '#000fff',\ 3 | 2 '#0090ff',\ 4 | 3 '#0fffee',\ 5 | 4 '#90ff70',\ 6 | 5 '#ffee00',\ 7 | 6 '#ff7000',\ 8 | 7 '#ee0000',\ 9 | 8 '#7f0000') 10 | 11 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_trends_1: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/trends.all.1.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot '../output/trends.all.1.dat' using 1:2 with steps t 'Group 1 trends' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_trends_2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/trends.all.2.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot '../output/trends.all.2.dat' using 1:2 with steps t 'Group 2 trends' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_trends_3: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/trends.all.3.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot '../output/trends.all.3.dat' using 1:2 with steps t 'Group 3 trends' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_trends_4: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/trends.all.4.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot '../output/trends.all.4.dat' using 1:2 with steps t 'Group 4 trends' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_trends_5: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/trends.all.5.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot '../output/trends.all.5.dat' using 1:2 with steps t 'Group 5 trends' 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_data: -------------------------------------------------------------------------------- 1 | set pm3d interpolate ii,ii map 2 | set style data pm3d 3 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 4 | set style line 9 linecolor rgb "black" pt 7 ps 0.5 5 | splot 'fort.68' using 1:2:3:3 t 'Analysis and data location','fort.99' using 1:2:3:3 with points ls 9 notitle 6 | #set palette rgbformulae 33,13,10 -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/error.pal.default: -------------------------------------------------------------------------------- 1 | set palette defined ( 0 '#fdfdf9',\ 2 | 1 '#eef9a9',\ 3 | 2 '#d7e486',\ 4 | 3 '#dcf72a',\ 5 | 4 '#F7EA2A',\ 6 | 5 '#F7A52A',\ 7 | 6 '#FC7302',\ 8 | 7 '#FC4D02',\ 9 | 8 '#9f0b04') 10 | 11 | 12 | -------------------------------------------------------------------------------- /Example4D/input/general_info: -------------------------------------------------------------------------------- 1 | ##Organizations name: 2 | SDN:EDMO::xxx = SDN:University of Liege, GeoHydrodynamics and Environment Research 3 | ##organisation e-mail adress: 4 | JM.Beckers@ulg.ac.be 5 | ##Climatolgy and Metadata author organisation (Collating Center) 6 | SDN:EDMO::EDMO xxx = SDN:EDMO University of Liege, GeoHydrodynamics and Environment Research 7 | ##Climatolgy and Metadata author e-mail adress 8 | M.Ouberdous@ulg.ac.be 9 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/general_info: -------------------------------------------------------------------------------- 1 | ##Organizations name: 2 | SDN:EDMO::1579 = SDN:University of Liege, GeoHydrodynamics and Environment Research 3 | ##organisation e-mail adress: 4 | JM.Beckers@ulg.ac.be 5 | ##Climatolgy and Metadata author organisation (Collating Center) 6 | SDN:EDMO::EDMO 1579 = SDN:EDMO University of Liege, GeoHydrodynamics and Environment Research 7 | ##Climatolgy and Metadata author e-mail adress 8 | M.Ouberdous@ulg.ac.be 9 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_RL: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.72 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | set style data pm3d 11 | set palette 12 | set cbrange[:] 13 | splot 'fort.72' using 1:2:0:3 t 'Relative Length scale' 14 | #end gnuplot commands 15 | exit 16 | EOF 17 | 18 | $gplot bidon 19 | 20 | else 21 | echo No plot produced 22 | 23 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_UV_coast: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.55 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | plot 'fort.55' using 1:2:3:4 with vectors head filled lt 3 t 'Velocity field','fort.67' using 1:2:(0.0) with lines lt 10 notitle 10 | #end gnuplot commands 11 | exit 12 | EOF 13 | 14 | $gplot bidon 15 | 16 | else 17 | echo No plot produced 18 | 19 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Pipetest/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | sources := $(wildcard *.f) 4 | executables := $(patsubst %.f,%.a,$(sources)) 5 | 6 | all : $(executables) 7 | 8 | %.a : %.f 9 | $(compiler) $(flags) $< -o $@ 10 | 11 | # Utility targets 12 | .PHONY: cleanall cleanobj cleanexec 13 | 14 | cleanall : cleanobj cleanexec 15 | 16 | cleanobj : 17 | rm *.o 18 | 19 | cleanexec : 20 | rm $(executables) 21 | 22 | 23 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divadress: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #echo Cleaning up the mess 3 | divaclean 4 | #echo Gridding 5 | divamesh 6 | #echo Analysing 7 | divacalc 8 | #echo Looking for outliers 9 | divaqcbis 10 | #echo Preparing cleaned up data 11 | dvoutlierclean 12 | echo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 13 | echo Diva finished the performance 14 | echo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 15 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvmakelog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Creates the file names for the log files 4 | # 5 | divarundir=$(pwd) 6 | divalog=$divarundir'/output/diva.log' 7 | divameshlog=$divarundir'/output/divamesh.log' 8 | divacalclog=$divarundir'/output/divacalc.log' 9 | divafitlog=$divarundir'/output/divafit.log' 10 | divagcvlog=$divarundir'/output/divagcv.log' 11 | divacvlog=$divarundir'/output/divacv.log' 12 | divacvrandlog=$divarundir'/output/divacvrand.log' 13 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_coastline: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | unset pm3d 10 | set style line 10 linetype 1 lw 2 linecolor rgb "black" 11 | 12 | 13 | plot 'fort.67' using 1:2 with lines lt 10 t 'DIVA coastlines' 14 | #end gnuplot commands 15 | exit 16 | EOF 17 | 18 | $gplot bidon 19 | 20 | else 21 | echo No plot produced 22 | 23 | fi 24 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvncmask2RL: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # WRITES RL.dat from mask.nc netcdf file 4 | # 5 | ##################################################### 6 | # 7 | cd ./3DWORK/ 8 | if [ -f ../input/mask.nc ];then 9 | cp ../input/mask.nc . 10 | else 11 | echo 'dvncmask2RL: Did not find ../input/mask.nc file ' 12 | exit 13 | fi 14 | # 15 | ../../bin/ncmask2RL.a 16 | 17 | cp RL.dat RLInfo.dat ../input/. 18 | cp RL.dat RLInfo.dat ../output/. 19 | 20 | rm -f mask.nc 21 | 22 | cd ../ 23 | -------------------------------------------------------------------------------- /JRA4/Climatology/Salinity.SDNconv: -------------------------------------------------------------------------------- 1 | ##Short name of the dataset: 2 | EMODNET_Salinity_4DNetCDF 3 | ##Parameters in dataset (see liste in ./input/SDN_P021.list): 4 | SDN:P021:68:PSAL = Salinity of the water column 5 | ##Thumbnail file name 6 | Sal_image 7 | ##Url compliment (to http://gher-diva.phys.ulg.ac.be/data/emodnet-domains/) 8 | Mediterranean Sea 9 | ##Geographical area name (see ./input/Geographical_areas.list) 10 | SDN:C16:8:28Bg = Mediterranean Sea 11 | ##Time units (month or season) 12 | month -------------------------------------------------------------------------------- /JRA4/Climatology/Temperature.SDNconv: -------------------------------------------------------------------------------- 1 | ##Short name of dataset: 2 | EMODNET_Temperature_4DNetCDF 3 | ##Parameters in dataset (see liste in ./input/SDN_P021.list): 4 | SDN:P021:68:TEMP = Temperature of the water column 5 | ##Thumbnail file name 6 | Tem_image 7 | ##Url compliment (to http://gher-diva.phys.ulg.ac.be/data/emodnet-domains/) 8 | Mediterranean Sea 9 | ##Geographical area name (see ./input/Geographical_areas.list) 10 | SDN:C16:8:28Bg = Mediterranean Sea 11 | ##Time units (month or season) 12 | month -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_RL_coast: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.67 -a -f fort.72 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | set style data pm3d 11 | set palette 12 | set cbrange[:] 13 | splot 'fort.72' using 1:2:0:3 t 'Relative Length scale','fort.67' using 1:2:(0.0) with lines lt 10 notitle 14 | #end gnuplot commands 15 | exit 16 | EOF 17 | 18 | $gplot bidon 19 | 20 | else 21 | echo No plot produced 22 | 23 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/sumup.f: -------------------------------------------------------------------------------- 1 | 2 | 3 | read(5,*,end=99) valex 4 | 99 continue 5 | 6 | 7 | 8 | 9 | 150 continue 10 | read(20,*,end=200) x,y,val 11 | read(21,*,end=200) x,y,val1 12 | diff=val+val1 13 | if (abs(val1-valex).lt.0.00001*abs(valex)) diff=0 14 | if (abs(val-valex).lt.0.00001*abs(valex)) diff=0 15 | write(22,*) x,y,diff 16 | goto 150 17 | 18 | 19 | 200 continue 20 | stop 21 | end 22 | 23 | 24 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvintegral: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | echo here you can select only a subset of grid points for integretion 4 | if [ -f ./input/integrationpoints.dat ] 5 | then 6 | echo will try to make subselectio 7 | # Select only points where analysis ($3>0) is positive or coordinates in a box 8 | # awk '{ if ($1 > -4 && $1 < 4 && $2 > -4 && $2 < 4 ) print $1,$2,$3,$4}' ./input/integrationpoints.dat > bidon 9 | # mv bidon ./input/integrationpoints.dat 10 | else 11 | echo Sorry, no list available 12 | exit 13 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | splot 'fort.68' using 1:2:3:3 t 'Analysis' 13 | #end gnuplot commands 14 | exit 15 | EOF 16 | 17 | $gplot bidon 18 | 19 | else 20 | echo No plot produced 21 | 22 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_DATABINS_coast: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.73 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | set style data pm3d 11 | set palette 12 | set cbrange[:] 13 | set zrange[:] 14 | splot 'fort.73' using 1:2:(0.0):3 t 'Data coverage','fort.67' using 1:2:(0.0):(0.0) with lines lt 10 notitle 15 | #end gnuplot commands 16 | exit 17 | EOF 18 | 19 | $gplot bidon 20 | 21 | else 22 | echo No plot produced 23 | 24 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_error: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 12 | splot 'fort.68' using 1:2:4:4 t 'Error field', 'fort.67' using 1:2:(0.0) with lines ls 9 notitle 13 | #end gnuplot commands 14 | exit 15 | EOF 16 | 17 | $gplot bidon 18 | 19 | else 20 | echo No plot produced 21 | 22 | fi 23 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_log: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | set logscale zcb 12 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 13 | splot 'fort.68' using 1:2:3:3 t 'Analysis' 14 | #end gnuplot commands 15 | exit 16 | EOF 17 | 18 | $gplot bidon 19 | 20 | else 21 | echo No plot produced 22 | 23 | fi -------------------------------------------------------------------------------- /JRA4/Climatology/specialdataonly: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | echo ====================================================== 4 | echo Before additional elimination 5 | wc -l "$1" 6 | # Example below, use only data where latidute value is below 57+0.6*longitude 7 | # and latitude larger than 10 8 | #awk -F " " '{if ($2 < 57.0+0.6*$1) {print $0}}' $1 > bidon 9 | #mv bidon $1 10 | #awk -F " " '{if ($1 > 10) {print $0}}' $1 > bidon 11 | #mv bidon $1 12 | echo After additional elimination 13 | wc -l "$1" 14 | echo ====================================================== 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.mod 2 | *.nc 3 | fort.* 4 | *.a 5 | *.swp 6 | *.o 7 | # Log files 8 | JRA4/Climatology/divadoall.* 9 | *.log 10 | # Diva directories 11 | DIVA3D/bin/ 12 | DIVA3D/divastripped/input/ 13 | DIVA3D/divastripped/logs/ 14 | DIVA3D/divastripped/output/ 15 | DIVA3D/divastripped/divawork/ 16 | DIVA3D/divastripped/meshgenwork/ 17 | DIVA3D/divastripped/gnuwork/xrangecova 18 | DIVA3D/divastripped/3DWORK/ 19 | DIVA3D/divastripped/workexerr/ 20 | JRA4/Climatology/input/ 21 | JRA4/Climatology/newinput/ 22 | JRA4/Climatology/output/ 23 | JRA4/Climatology/Datawork/ 24 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_mesh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.71 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | unset pm3d 10 | set style line 10 linetype 1 lw 2 linecolor rgb "black" 11 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 12 | 13 | plot 'fort.71' using 1:2 with lines ls 9 t 'DIVA mesh', 'fort.67' using 1:2 with lines ls 10 notitle 14 | #end gnuplot commands 15 | exit 16 | EOF 17 | 18 | $gplot bidon 19 | 20 | else 21 | echo No plot produced 22 | 23 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvrtimesx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | if [ "$#" != "2" ] 5 | then 6 | echo '==========================================' 7 | echo Usage: 8 | echo ' ' dvtimesx LC icoord 9 | echo Example: coorelation length ob obs noise 0.1 10 | echo ' ' with coordinates transformed in km 11 | echo ' ' dvtimesx 0.1 1 12 | echo '==========================================' 13 | 14 | exit 15 | fi 16 | 17 | cp ./input/data.dat.x ./divawork/fort.20 18 | cd divawork 19 | echo $1 $2 | ../../bin/Rtimesx.a 20 | cd .. 21 | cp ./divawork/fort.21 ./output/data.dat.Rx 22 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_std: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.67 -a -f fort.79 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 12 | 13 | #end gnuplot commands 14 | exit 15 | EOF 16 | 17 | echo "splot 'fort.79' using" '1:2:(sqrt($3)):(sqrt($3))' "t 'Standard deviation', 'fort.67' using 1:2:(0.0) with lines ls 9 notitle" >> bidon 18 | 19 | $gplot bidon 20 | 21 | else 22 | echo No plot produced 23 | 24 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | sources := $(wildcard *.f *.f90) 4 | executables := $(addprefix $(BINDIR),diva.a) 5 | 6 | all : $(executables) 7 | 8 | $(executables): | $(BINDIR) 9 | 10 | $(BINDIR) : 11 | $(MKDIR) $(BINDIR) 12 | 13 | $(executables) : $(sources) divainc.h divapre.h 14 | $(compiler) $(flags) $(flagscalc) $(sources) -o $@ 15 | 16 | # Utility targets 17 | .PHONY: cleanall cleanobj cleanexec 18 | 19 | cleanall : cleanobj cleanexec 20 | 21 | cleanobj : 22 | rm *.o 23 | 24 | cleanexec : 25 | rm $(executables) 26 | 27 | 28 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_DATABINS_coast_log: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.67 -a -f fort.73 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | 10 | set pm3d map 11 | set style data pm3d 12 | set palette 13 | set cbrange[:] 14 | set zrange[:] 15 | 16 | #end gnuplot commands 17 | 18 | EOF 19 | echo \ 20 | "splot 'fort.73' using 1:2:(0.0):"'(log10($3))'" t 'Data coverage, Log10','fort.67' using 1:2:(0.0):(0.0) with lines lt 10 notitle" >> bidon 21 | 22 | 23 | $gplot bidon 24 | 25 | else 26 | echo No plot produced 27 | 28 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/cverror.f: -------------------------------------------------------------------------------- 1 | parameter (nmax=30000000) 2 | integer*2 ic(nmax) 3 | real*8 err 4 | 5 | 6 | 7 | err=0 8 | read(5,*) valex 9 | 10 | i=0 11 | 101 continue 12 | 13 | read(20,*,end=200,err=200) x,y,val 14 | 15 | read(21,*,end=200,err=200) x1,y1,val1 16 | 17 | if (val.ne.valex.and.val1.ne.valex) then 18 | err=err+(val-val1)**2 19 | i=i+1 20 | endif 21 | goto 101 22 | 200 continue 23 | write(22,*) err,i,sqrt(err/i) 24 | stop 25 | end 26 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_mesh_numbered: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.69 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | 11 | 12 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 13 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 14 | 15 | set palette 16 | 17 | splot 'fort.69' using 1:2:3:4 with pm3d t 'Mesh coloured by index' 18 | 19 | #set palette rgbformulae 33,13,10 20 | #end gnuplot commands 21 | exit 22 | EOF 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_mesh_projection: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | unset pm3d 10 | set style line 10 linetype 1 lw 2 linecolor rgb "black" 11 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 12 | set angles degrees 13 | 14 | set xtics ("longref" 0) 15 | 16 | 17 | #end gnuplot commands 18 | exit 19 | EOF 20 | echo "plot 'fort.71' using " '(($1-longref)*cos($2)):($2)' " with lines ls 9 t 'DIVA mesh'" >> bidon 21 | $gplot bidon 22 | 23 | else 24 | echo No plot produced 25 | 26 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/analysis.pal.globalsalinity: -------------------------------------------------------------------------------- 1 | set palette defined ( \ 2 | 0 "gray20" ,\ 3 | 4 "gray60" ,\ 4 | 6 "light-blue", \ 5 | 8 "skyblue",\ 6 | 10 "aquamarine", \ 7 | 12 "turquoise", \ 8 | 14 "dark-turquoise",\ 9 | 15 "gray50", \ 10 | 15 "gray50", \ 11 | 16 "light-green", \ 12 | 17 "sea-green",\ 13 | 17 "sea-green",\ 14 | 18 "light-yellow", \ 15 | 19 "light-red",\ 16 | 20 "khaki",\ 17 | 21 "gray60",\ 18 | 22 "dark-blue", \ 19 | 23 "royalblue",\ 20 | 33 "blue", \ 21 | 35 "green", \ 22 | 37 "yellow", \ 23 | 38 "red", \ 24 | 39.5 "dark-red",\ 25 | 39.5 "dark-red",\ 26 | 40 "violet",\ 27 | 42 "gray10") 28 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_masked: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | set style data pm3d 11 | 12 | set pm3d clip4in 13 | 14 | 15 | set zrange[0:thresh] 16 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 17 | splot 'fort.68' using 1:2:4:3 t gprintf("Clipping at error level threshold=%E ",thresh), 'fort.67' using 1:2:(0.0) with lines ls 9 notitle 18 | #end gnuplot commands 19 | exit 20 | EOF 21 | 22 | $gplot bidon 23 | 24 | else 25 | echo No plot produced 26 | 27 | fi 28 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Pipetest/pipetest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -f fort.* 4 | rm -f divapipe 5 | rm -f dvping 6 | rm -f dvpong 7 | mkfifo dvping 8 | mkfifo dvpong 9 | mkdir -p sub 10 | cd sub 11 | rm -f fort.* 12 | echo 1 > fort.55 13 | ../piperw.a & 14 | cd .. 15 | echo 0 > fort.55 16 | ./piperw.a 17 | 18 | cat fort.66 19 | 20 | echo If problems were encountered during execution, please check for 21 | echo still running piperw.a \( ps -eafl piperw.a \) and kill them 22 | echo Possibly run the pipetest again 23 | 24 | rm -f fort.* 25 | rm -f divapipe 26 | rm -f dvping 27 | rm -f dvpong 28 | mkdir -p sub 29 | cd sub 30 | rm -f fort.* 31 | cd .. 32 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/ncdf2gher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #------------------------------------------------ 4 | # Sylvain Watelet - 02/12/2014 5 | # swatelet@ulg.ac.be 6 | # 7 | # This script transforms a netcdf file (myfield.nc) 8 | # into gher format (myfield.grd) + an info file 9 | # (myfield.dat). 10 | #------------------------------------------------ 11 | 12 | myfield=$1 13 | 14 | if [ "$1" == "" ] 15 | then 16 | echo "Error : no argument !" 17 | echo "Usage : ./ncdf2gher myfield" 18 | exit 19 | fi 20 | 21 | echo "The field to transform is $myfield" 22 | 23 | ncfile=./input/${myfield}.nc 24 | 25 | ../bin/ncdf2gher.a $ncfile $myfield 26 | 27 | 28 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | sources := $(wildcard *.f *.f90) 4 | executables := $(addprefix $(BINDIR),$(patsubst %.f,%.a,$(patsubst %.f90,%.a,$(sources)))) 5 | 6 | all : $(executables) 7 | 8 | $(executables): | $(BINDIR) 9 | 10 | $(BINDIR): 11 | $(MKDIR) $(BINDIR) 12 | 13 | $(BINDIR)%.a : %.f 14 | $(compiler) $(flags) -o $@ $< 15 | 16 | $(BINDIR)%.a : %.f90 17 | $(compiler) $(flags) -o $@ $< 18 | 19 | # Utility targets 20 | .PHONY: cleanall cleanobj cleanexec 21 | 22 | cleanall : cleanobj cleanexec 23 | 24 | cleanobj : 25 | rm *.o 26 | 27 | cleanexec : 28 | rm $(executables) 29 | 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/calcest.f: -------------------------------------------------------------------------------- 1 | 2 | read(5,*) RL,SNR, nbcol,GCVVAL,tracea 3 | write(6,*) RL, SNR, nbcol,GCVVAL,tracea 4 | w=1 5 | 6 | if (nbcol.eq.3) then 7 | 8 | write(6,*) '3col' 9 | 150 continue 10 | read(44,*,end=200) x,y,val 11 | C write(6,*) x,y,val,w 12 | write(76,*) x,y,GCVVAL/sqrt(w)*(1-tracea) 13 | goto 150 14 | 15 | else 16 | 17 | write(6,*) '4col' 18 | 160 continue 19 | read(44,*,end=200) x,y,val,w 20 | C write(6,*) x,y,val,w 21 | write(76,*) x,y,GCVVAL/sqrt(w)*(1-tracea) 22 | goto 160 23 | 24 | endif 25 | 26 | 200 continue 27 | stop 28 | end 29 | 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/calcestbis.f: -------------------------------------------------------------------------------- 1 | 2 | read(5,*) RL,SNR, nbcol,GCVVAL,tracea,varbak 3 | write(6,*) RL, SNR, nbcol,GCVVAL,tracea,varbak 4 | w=1 5 | EPS=sqrt(varbak/SNR*(1-tracea)) 6 | if (nbcol.eq.3) then 7 | 8 | write(6,*) '3col' 9 | 150 continue 10 | read(44,*,end=200) x,y,val 11 | C write(6,*) x,y,val,w 12 | write(76,*) x,y,EPS/sqrt(w) 13 | goto 150 14 | 15 | else 16 | 17 | write(6,*) '4col' 18 | 160 continue 19 | read(44,*,end=200) x,y,val,w 20 | C write(6,*) x,y,val,w 21 | write(76,*) x,y,EPS/sqrt(w) 22 | goto 160 23 | 24 | endif 25 | 26 | 200 continue 27 | stop 28 | end 29 | 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/readme: -------------------------------------------------------------------------------- 1 | To compile the code you have two main possibilities: 2 | 3 | 1. Work with the specific script: 4 | 5 | a) edit the file 'divacompile_options' according to your installation 6 | b) run the script 'divacompileall' 7 | 8 | 2. Use the Makefile 9 | 10 | a) edit the file 'Makefile' 11 | b) type 'make' or 'make all' 12 | 13 | 14 | In both cases you need to have the netCDF library installed. 15 | Following the procedures from 16 | http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html (netCDF C library) and 17 | http://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html (netCDF Fortran). 18 | 19 | 20 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_data: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.99 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 13 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 14 | 15 | 16 | 17 | splot 'fort.99' using 1:2:3:3 with points palette pt 7 ps 0.5 t 'Data' 18 | 19 | #set palette rgbformulae 33,13,10 20 | #end gnuplot commands 21 | exit 22 | EOF 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/cvtotalerror.f: -------------------------------------------------------------------------------- 1 | parameter (nmax=30000000) 2 | integer*2 ic(nmax) 3 | real*8 errc,errt,datavar,datavart 4 | 5 | 6 | 7 | 8 | read(5,*) cvval 9 | errt=0 10 | datavart=0 11 | i=0 12 | j=0 13 | 101 continue 14 | 15 | read(20,*,end=200,err=200) errc,n 16 | read(21,*,end=200,err=200) datavar,nd 17 | i=i+n 18 | j=j+nd 19 | errt=errt+errc 20 | datavart=datavart+datavar*nd 21 | goto 101 22 | 200 continue 23 | write(22,76) cvval,sqrt(errt/i),datavart/j, 24 | & sqrt(errt)/i,0.0,0.0,float(i) 25 | 76 FORMAT(7(E11.4)) 26 | stop 27 | end 28 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_points: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.99 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | set style line 9 linecolor rgb "black" pt 7 ps 0.5 13 | splot 'fort.68' using 1:2:3:3 t 'Analysis and data location','fort.99' using 1:2:3:3 with points ls 9 notitle 14 | #set palette rgbformulae 33,13,10 15 | #end gnuplot commands 16 | exit 17 | EOF 18 | 19 | $gplot bidon 20 | 21 | else 22 | echo No plot produced 23 | 24 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Mesh/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | sources := $(wildcard *.f) 4 | generopt := $(addprefix $(BINDIR),$(patsubst %.f,%.a,$(wildcard generopt*.f))) 5 | executables := $(addprefix $(BINDIR),$(patsubst %.f,%.a,$(sources))) 6 | 7 | all : $(executables) 8 | 9 | $(BINDIR)contourcheck.a $(generopt): iodv.h 10 | 11 | $(executables): | $(BINDIR) 12 | 13 | $(BINDIR): 14 | $(MKDIR) $(BINDIR) 15 | 16 | $(executables) : $(BINDIR)%.a : %.f 17 | $(compiler) $(flags) $< -o $@ 18 | 19 | # Utility targets 20 | .PHONY: cleanall cleanobj cleanexec 21 | 22 | cleanall : cleanobj cleanexec 23 | 24 | cleanobj : 25 | rm *.o 26 | 27 | cleanexec : 28 | rm $(executables) 29 | 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/calcmuc.f: -------------------------------------------------------------------------------- 1 | 2 | read(5,*,end=99,err=100) RL,SNR,xi 3 | 99 continue 4 | unsk=16*Atan(1.0) 5 | 6 | if(abs(xi).gt.1.) then 7 | angle=log(abs(xi)+sqrt(xi*xi-1)) 8 | if (angle.eq.0.) then 9 | unsk=16*Atan(1.0) 10 | else 11 | unsk=16*Atan(1.0)*sinh(angle)/angle 12 | endif 13 | endif 14 | 15 | if(abs(xi).le.1) then 16 | angle=acos(xi) 17 | if (angle.eq.0.) then 18 | unsk=16*Atan(1.0) 19 | else 20 | unsk=16*Atan(1.0)*sin(angle)/angle 21 | endif 22 | endif 23 | write(6,*) unsk*SNR/(RL*RL) 24 | stop 25 | 100 continue 26 | write(6,*) 16*Atan(1.0) 27 | stop 28 | end 29 | 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_projection: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | set angles degrees 13 | 14 | set xtics ("longref" 0) 15 | EOF 16 | echo \ 17 | "splot 'fort.68' using" '(($1-longref)*cos($2)):($2):(0.0):($3) t' "'Analysis, projected'#,'fort.67' using "'(($1-longref)*cos($2)):($2):(0.0) with lines ls 9 notitle' >> bidon 18 | 19 | 20 | 21 | $gplot bidon 22 | 23 | else 24 | echo No plot produced 25 | 26 | fi -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: 3 | - linux 4 | 5 | env: 6 | - FORTRANDIR="$(pwd)/DIVA3D/src/Fortran/" DIVADIR="$(pwd)/DIVA3D/divastripped/" 7 | 8 | sudo: required 9 | addons: 10 | apt: # apt-get for linux 11 | packages: 12 | - libhdf5-serial-dev 13 | - libnetcdf-dev 14 | - libnetcdff-dev 15 | - netcdf-bin 16 | - gfortran 17 | 18 | install: 19 | - echo "Source directory --> ${FORTRANDIR}" 20 | - echo "DIVA directory --> ${DIVADIR}" 21 | 22 | before_script: 23 | - export PATH=${PATH}:. 24 | 25 | script: 26 | - cd ${FORTRANDIR}; make clean; make 27 | - cd ${DIVADIR}; ./divatest0 28 | 29 | after_success: 30 | - bash <(curl -s https://codecov.io/bash) 31 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_RL_coast_points: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.72 -a -f fort.99 ] 4 | then 5 | if [ -f fort.67 ] 6 | then 7 | 8 | echo gnuplot is $gplot 9 | awk '{print $0 >> "bidon"}' << EOF 10 | #the gnuplot commands 11 | set pm3d map 12 | set style data pm3d 13 | set palette 14 | set style line 6 linecolor rgbcolor "black" pt 7 ps 0.5 15 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 16 | set cbrange[:] 17 | splot 'fort.72' using 1:2:0:3 t 'Relative Length scale','fort.99' using 1:2:(0.0):(0.0) with points ls 6 notitle,'fort.67' using 1:2:(0.0):(0.0) with lines lt 10 notitle 18 | 19 | #end gnuplot commands 20 | exit 21 | EOF 22 | 23 | $gplot bidon 24 | exit 25 | fi 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /Example4D/driver: -------------------------------------------------------------------------------- 1 | Data extraction: 1 do it, 0 do nothing, -1 press coord, -10 pressure+Saunders 2 | 1 3 | boundary lines and coastlines generation: 0 nothing, 1: contours, 2: UV, 3: 1+2 4 | 1 5 | cleaning data on mesh: 1, 2: RL, 3: both, 4: 1 + outliers elimination, 5: =4+2 6 | 0 7 | minimal number of data in a layer. If less, uses data from any month. 8 | 0 9 | Parameters estimation and vertical filtering: 10 | -30 11 | Minimal L 12 | 1.4 13 | Maximal L 14 | 10. 15 | Minimal SN 16 | 0.1 17 | Maximal SN 18 | 5.0 19 | Analysis and reference field: 20 | 1 21 | lowerlevel number 22 | 1 23 | upperlevel number 24 | 4 25 | 4D netcdf files generation: 26 | 0 27 | gnuplot plots: 0 or 1 28 | 0 29 | Data detrending: number of groups, 0 if no detrending. 30 | 0 31 | -------------------------------------------------------------------------------- /Example4D/input/NCDFinfo_salinity: -------------------------------------------------------------------------------- 1 | # Salinity long name string: 2 | 'Salinity' 3 | # salinity units string: 4 | 'psu' 5 | # Title string for salinity 3D NetCDF file: 6 | 'Diva 3D analysis of salinity variable' 7 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 8 | 'months since since 1900-01-01' 9 | # Time value (that reprsents the data set), if not climatological data 10 | 1200 11 | # Cell_methode string: 12 | 'time: mean (month 02 data from all years)' 13 | # Institution name: where the dataset was produced. 14 | 'ULg_GHER' 15 | # Production group and date 16 | 'Diva group' 17 | # Source (observation, radiosonde, database, model-generated data,...) 18 | 'Medar merged data' 19 | #Comment 20 | 'No comment' 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gher2ncdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #------------------------------------------------ 4 | # Sylvain Watelet - 02/12/2014 5 | # swatelet@ulg.ac.be 6 | # 7 | # This script transforms a gher file (myfield.grd) 8 | # + an info file (myfield.dat) into a netcdf file 9 | # (myfield.nc) 10 | #------------------------------------------------ 11 | 12 | 13 | myfield=$1 14 | 15 | if [ "$1" == "" ] 16 | then 17 | echo "Error : no argument !" 18 | echo "Usage : ./ncdf2gher myfield" 19 | exit 20 | fi 21 | 22 | echo "The field to transform is $myfield" 23 | 24 | gherfile=./input/${myfield}.grd 25 | infofile=./input/${myfield}Info.dat 26 | 27 | ../bin/gher2ncdf.a $gherfile $infofile $myfield 28 | 29 | ncfile=${myfield}.nc 30 | mv $ncfile ./input/ 31 | 32 | 33 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_mesh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.69 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 13 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 14 | 15 | 16 | 17 | splot 'fort.68' using 1:2:(-0.1):3 with pm3d t 'Analysis and mesh','fort.69' using 1:2:(-0.05) with lines ls 9 notitle 18 | 19 | #set palette rgbformulae 33,13,10 20 | #end gnuplot commands 21 | exit 22 | EOF 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /JRA4/Climatology/input/NCDFinfo_salinity: -------------------------------------------------------------------------------- 1 | # Salinity long name string: 2 | 'Salinity' 3 | # salinity units string: 4 | 'psu' 5 | # Title string for salinity 3D NetCDF file: 6 | 'Diva 3D analysis of salinity variable' 7 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 8 | 'months since since 1900-01-01' 9 | # Time value (that reprsents the data set), if not climatological data 10 | 1200 11 | # Cell_methode string: 12 | 'time: mean (month 02 data from all years)' 13 | # Institution name: where the dataset was produced. 14 | 'ULg_GHER' 15 | # Production group and date 16 | 'Diva group' 17 | # Source (observation, radiosonde, database, model-generated data,...) 18 | 'Medar merged data' 19 | #Comment 20 | 'No comment' 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_error_data: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.99 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "white", 1 "red", 2 "dark-red" ) 12 | set style line 6 linecolor rgbcolor "black" pt 7 ps 0.5 13 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 14 | splot 'fort.68' using 1:2:4:4 t 'Error field and data location','fort.99' using 1:2:(0.0) with points ls 6 notitle, 'fort.67' using 1:2:(0.0) with lines ls 9 notitle 15 | #set palette rgbformulae 33,13,10 16 | #end gnuplot commands 17 | exit 18 | EOF 19 | 20 | $gplot bidon 21 | 22 | else 23 | echo No plot produced 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /Example4D/input/NCDFinfo_temperature: -------------------------------------------------------------------------------- 1 | # Temperature long name string: 2 | 'Potential temperatures' 3 | # variable units string: 4 | 'degrees_C' 5 | # Title string for temperature 3D NetCDF file: 6 | 'Diva 3D analysis of temperature variable' 7 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 8 | 'months since since 1900-01-01' 9 | # Time value (that reprsents the data set), if not climatological data 10 | 1200 11 | # Cell_methode string: 12 | 'time: mean (month 02 data from all years)' 13 | # Institution name: where the dataset was produced. 14 | 'ULg_GHER' 15 | # Production group and date 16 | 'Diva group' 17 | # Source (observation, radiosonde, database, model-generated data,...) 18 | 'Medar merged data' 19 | #Comment 20 | 'No comment' 21 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_data_coast_outliers: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.67 -a -f fort.43 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | 11 | set palette defined ( 0 "green", 3 "yellow", 5 "red", 6 "dark-red" ) 12 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 13 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 14 | set cbrange[0:6] 15 | 16 | 17 | splot 'fort.43' using 3:4:(0.0):1 with points palette pt 7 ps 1.1 t 'Outliers and DIVA coastline', 'fort.67' using 1:2:(0.0) with lines lt 10 notitle 18 | 19 | #set palette rgbformulae 33,13,10 20 | #end gnuplot commands 21 | exit 22 | EOF 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_data_mesh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.69 -a -f fort.99 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d map 10 | 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 13 | set style line 9 linetype 1 lw 1 linecolor rgb "light-gray" 14 | 15 | 16 | 17 | splot 'fort.69' using 1:2:(-0.05) with lines ls 9 notitle,'fort.99' using 1:2:(0.0):3 with points palette pt 7 ps 0.5 t 'Data' 18 | 19 | #set palette rgbformulae 33,13,10 20 | #end gnuplot commands 21 | exit 22 | EOF 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi 30 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/NCDFinfo_temperature: -------------------------------------------------------------------------------- 1 | # Temperature long name string: 2 | 'Potential temperatures' 3 | # variable units string: 4 | 'degrees_C' 5 | # Title string for temperature 3D NetCDF file: 6 | 'Diva 3D analysis of temperature variable' 7 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 8 | 'months since since 1900-01-01' 9 | # Time value (that reprsents the data set), if not climatological data 10 | 1200 11 | # Cell_methode string: 12 | 'time: mean (month 02 data from all years)' 13 | # Institution name: where the dataset was produced. 14 | 'ULg_GHER' 15 | # Production group and date 16 | 'Diva group' 17 | # Source (observation, radiosonde, database, model-generated data,...) 18 | 'Medar merged data' 19 | #Comment 20 | 'No comment' 21 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_error_projection: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.67 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "white", 1 "red", 2 "dark-red" ) 12 | set angles degrees 13 | 14 | set xtics ("longref" 0) 15 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 16 | 17 | #end gnuplot commands 18 | exit 19 | EOF 20 | echo \ 21 | "splot 'fort.68' using " '(($1-longref)*cos($2)):($2):(0.0):($4) ' "t 'Error field, projected'#,'fort.67' using " '(($1-longref)*cos($2)):($2):(0.0) with lines ls 9 notitle '>> bidon 22 | 23 | 24 | $gplot bidon 25 | 26 | else 27 | echo No plot produced 28 | 29 | fi 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dv3Dtrans: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##################################################### 3 | # 4 | # $1 = level number 5 | # $2 = variable name. 6 | #====================================== 7 | lev=$1 8 | var=$2 9 | if [ -f ./input/divatrans/$var.$lev.anl.mat ];then 10 | if [ -f ./output/3Danalysis/Fields/$var.$lev.anl ];then 11 | cp ./output/3Danalysis/Fields/$var.$lev.anl ./output/3Danalysis/Fields/$var.$lev.anl.trsf 12 | gherfile=$var.$lev.anl 13 | # matlab="matlab -nosplash -nodesktop" 14 | # $matlab <> "bidon"}' << EOF 8 | #the gnuplot commands 9 | 10 | set pm3d map 11 | 12 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 13 | set style line 10 linetype 1 lw 2 linecolor rgb "yellow" 14 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 15 | 16 | 17 | 18 | splot 'fort.99' using 1:2:(0.0):3 with points palette pt 7 ps 0.5 t 'Data and DIVA coastline', 'fort.67' using 1:2:(0.0) with lines ls 9 notitle 19 | 20 | #set palette rgbformulae 33,13,10 21 | #end gnuplot commands 22 | exit 23 | EOF 24 | 25 | $gplot bidon 26 | 27 | else 28 | echo No plot produced 29 | 30 | fi -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/boundval.F: -------------------------------------------------------------------------------- 1 | ! 2 | PROGRAM MINMAXVA 3 | ! 4 | ! 5 | implicit none 6 | ! 7 | !------------------------------------------------------------ 8 | ! 9 | REAL :: rmin,rmax,parval 10 | ! 11 | CHARACTER (len=8) :: VARFILEIN,VARFILOUT 12 | !------------------------------------------------------------ 13 | ! 14 | VARFILEIN = 'MinMaxVa' 15 | VARFILOUT = 'ParamVal' 16 | ! 17 | OPEN(2,FILE=VARFILEIN,STATUS='OLD') 18 | READ(2,*) rmin 19 | READ(2,*) rmax 20 | READ(2,*) parval 21 | CLOSE(2) 22 | IF(parval .le. rmin) parval = rmin 23 | IF(parval .ge. rmax) parval = rmax 24 | OPEN(3,FILE=VARFILOUT) 25 | WRITE(3,*) parval 26 | CLOSE(3) 27 | ! 28 | stop 29 | end 30 | 31 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/diva4Dncwrite: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # WRITES 4D NETCDF FILES 4 | # 5 | ##################################################### 6 | # 7 | var="$1" 8 | # 9 | vld=$2 10 | # 11 | cd ./3DWORK/ 12 | cp -v '../output/3Danalysis/'"$var"'.3DNCliste' './3Dncliste' 13 | cp -v '../output/3Danalysis/'"$var"'.3DNCinfo' './3DNCinfo' 14 | # 15 | rm -f sextantcatalog_id 16 | system=`uname` 17 | if [ "$system" != "Linux" ] 18 | then 19 | uuidgen > sextantcatalog_id 20 | else 21 | uuidgen -r > sextantcatalog_id 22 | fi 23 | 24 | if [ -f fort.44 ];then 25 | rm fort.44 26 | fi 27 | # 28 | nbfls=`cat './3Dncliste' |wc -l` 29 | echo $nbfls >> ./fort.44 30 | 31 | if [ "$vld" == "0" ]; then 32 | ../../bin/diva4Dstr.a 33 | fi 34 | if [ "$vld" == "1" ]; then 35 | ../../bin/diva4Dqcwrt.a 36 | fi 37 | # 38 | cd ../ 39 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_analysis_kml: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | set pm3d interpolate ii,ii map 10 | set style data pm3d 11 | #set palette defined ( 0 "dark-blue", 1 "blue", 1.7 "green", 2.5 "yellow", 2.6 "yellow", 4 "red", 5 "dark-red" ) 12 | unset colorbox 13 | set style line 7 linecolor rgbcolor "light-gray" lw 0 14 | set border 15 ls 7 15 | #set border 0 16 | set xtics nomirror 17 | set ytics nomirror 18 | set noxtics 19 | set noytics 20 | set bmargin 0 21 | set lmargin 0 22 | set rmargin 0 23 | set tmargin 0 24 | set size 1,1 25 | 26 | splot 'fort.68' using 1:2:3:3 notitle 27 | #end gnuplot commands 28 | exit 29 | EOF 30 | 31 | $gplot bidon 32 | 33 | else 34 | echo No plot produced 35 | 36 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_error_points: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f fort.68 -a -f fort.99 ] 4 | then 5 | if [ -f fort.67 ] 6 | then 7 | 8 | echo gnuplot is $gplot 9 | awk '{print $0 >> "bidon"}' << EOF 10 | #the gnuplot commands 11 | set pm3d interpolate ii,ii map 12 | set style data pm3d 13 | #set palette defined ( 0 "white", 1 "red", 2 "dark-red" ) 14 | set style line 6 linecolor rgbcolor "black" pt 7 ps 0.5 15 | set style line 9 linetype 1 lw 1 linecolor rgb "black" 16 | splot 'fort.68' using 1:2:4:4 t 'Error field and data location','fort.99' using 1:2:(0.0) with points ls 6 notitle, 'fort.67' using 1:2:(0.0) with lines ls 9 notitle 17 | #set palette rgbformulae 33,13,10 18 | #end gnuplot commands 19 | exit 20 | EOF 21 | 22 | $gplot bidon 23 | 24 | exit 25 | fi 26 | else 27 | echo No plot produced 28 | 29 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/dv3Ddoqcfiles: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | ################ 3 | # 4 | bottm=$1 5 | surf=$2 6 | var=$3 7 | itrans=$4 8 | # 9 | if [ -d ./3DWORK ];then 10 | echo 'starting divaqc files generation' 11 | else 12 | mkdir -p ./3DWORK 13 | echo 'starting divaqc files generation' 14 | fi 15 | # 16 | dep=$bottm 17 | rm -f ./3DWORK/fort.44 18 | while [ $dep -le $surf ] 19 | do 20 | let level=$((10000+$dep)) 21 | # 22 | cd ./input/divadata 23 | 24 | file=$var.$level 25 | nbln=$(cat $file |wc -l) 26 | 27 | echo $var > ../../3DWORK/fort.44 28 | echo $nbln >> ../../3DWORK/fort.44 29 | echo $dep >> ../../3DWORK/fort.44 30 | cd ../../3DWORK/ 31 | ../../bin/dvqcfiles.a 32 | cd ../ 33 | # 34 | dep=`expr $dep + 1` 35 | done 36 | echo 'finished with divaqcfiles' 37 | # 38 | # End transformations 39 | ################################# 40 | # 41 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/datadiff.f: -------------------------------------------------------------------------------- 1 | 2 | read(5,*,end=99) nbcol 3 | read(5,*,end=99) valex 4 | 99 continue 5 | 6 | if (nbcol.eq.3) then 7 | 8 | write(6,*) '3col' 9 | 150 continue 10 | read(44,*,end=200) x,y,val 11 | read(45,*,end=200) x,y,val1 12 | diff=val-val1 13 | if (abs(val1-valex).lt.0.00001*abs(valex)) diff=0 14 | write(46,*) x,y,diff 15 | goto 150 16 | 17 | else 18 | 19 | write(6,*) '4col' 20 | 160 continue 21 | read(44,*,end=200) x,y,val,w 22 | read(45,*,end=200) x,y,val1 23 | diff=val-val1 24 | if (abs(val1-valex).lt.0.00001*abs(valex)) diff=0 25 | 26 | write(46,*) x,y,diff,w 27 | 28 | goto 160 29 | 30 | endif 31 | 32 | 200 continue 33 | stop 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /JRA4/Climatology/driver: -------------------------------------------------------------------------------- 1 | Data extraction: 1 do it, 0 do nothing, -1 press coord, -10 pressure+Saunders 2 | 0 3 | boundary lines and coastlines generation: 0 nothing, 1: contours, 2: UV, 3: 1+2 4 | 0 5 | cleaning data on mesh: 1, 2: RL, 3: both, 4: 1 + outliers elimination, 5: =4+2 6 | 1 7 | minimal number of data in a layer. If less, uses data from any month. -1 : never uses data from other months 8 | 0 9 | Parameters estimation and vertical filtering: 10 | 1 11 | Minimal L 12 | 1.4 13 | Maximal L 14 | 10. 15 | Minimal SN 16 | 0.1 17 | Maximal SN 18 | 50.0 19 | Analysis and reference field: 20 | 0 21 | lowerlevel number (should be compatible with values in contour.depth) 22 | 1 23 | upperlevel number 24 | 1 25 | 4D netcdf files generation: 26 | 0 27 | gnuplot plots: 0 or 1 28 | 1 29 | Data detrending: number of groups, 0 if no detrending. 30 | 0 31 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | ureadwrite := ureadc.f uwritc.f 4 | sources := $(filter-out $(ureadwrite), $(wildcard *.f)) 5 | objects := $(patsubst %.f,%.o,$(ureadwrite)) 6 | executables := $(addprefix $(BINDIR),$(patsubst %.f,%.a,$(sources))) 7 | 8 | all : $(objects) $(executables) 9 | 10 | $(executables): | $(BINDIR) 11 | 12 | $(BINDIR): 13 | $(MKDIR) $(BINDIR) 14 | 15 | ureadc.o : ureadc.f 16 | $(compiler) -c $(flags) ureadc.f -o ureadc.o 17 | 18 | uwritc.o : uwritc.f 19 | $(compiler) -c $(flags) uwritc.f -o uwritc.o 20 | 21 | $(executables) : $(BINDIR)%.a : %.f 22 | $(compiler) $(nocyg) $(nclib) $< -o $@ 23 | 24 | # Utility targets 25 | .PHONY: cleanall cleanobj cleanexec 26 | 27 | cleanall : cleanobj cleanexec 28 | 29 | cleanobj : 30 | rm *.o 31 | 32 | cleanexec : 33 | rm $(executables) 34 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvdataclean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | source divalogging 5 | 6 | divaecho "Going to clean data points outside the mesh" >> ${divadatalog} 7 | valex=$(head -22 ./input/param.par | tail -1) 8 | divaecho "Using valex $valex" >> ${divadatalog} 9 | awk -v valex=$valex 'NR==FNR {s[i++]=$0; next; j=0} { if ( ($3-valex)*($3-valex) > 0.0000000001*(valex*valex) ) {j=j+1;print s[j-1]} else {j=j+1}}' ./input/data.dat ./output/fieldatdatapoint.anl > ./input/data.dat.clean 10 | divaecho "Before cleaning" | tee -a ${divadatalog} 11 | divaecho "$(wc -l ./input/data.dat)" | tee -a ${divadatalog} 12 | divaecho "After cleaning of points outside of the mesh" | tee -a ${divadatalog} 13 | divaecho "$(wc -l ./input/data.dat.clean)" | tee -a ${divadatalog} 14 | mv -v ./input/data.dat ./input/data.beforeclean.dat 15 | mv -v ./input/data.dat.clean ./input/data.dat 16 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/wgcvfile.F: -------------------------------------------------------------------------------- 1 | ! 2 | PROGRAM WCGCVSAMP 3 | ! 4 | implicit none 5 | ! 6 | !------------------------------------------------------------- 7 | ! 8 | integer, parameter :: NVT = 7 9 | INTEGER :: i 10 | ! 11 | REAL :: rmin,rmax 12 | REAL, DIMENSION(0:NVT) :: LSN,SN 13 | ! 14 | !-------------------------------------------------------------- 15 | ! 16 | ! 17 | OPEN(2,FILE='fort.11',STATUS='OLD') 18 | READ(2,*) rmin,rmax 19 | CLOSE(2) 20 | ! 21 | LSN(0) = LOG(rmin) 22 | LSN(NVT) = LOG(rmax) 23 | DO I = 1,NVT-1 24 | LSN(I) = LSN(0) + FLOAT(I)*(LSN(NVT)-LSN(0))/NVT 25 | ENDDO 26 | SN(:) = EXP(LSN(:)) 27 | open(2,FILE='../input/gcvsampling.dat') 28 | DO I = 0,NVT 29 | write(2,*) SN(I) 30 | ENDDO 31 | close(2) 32 | ! 33 | stop 34 | end 35 | 36 | -------------------------------------------------------------------------------- /Example4D/input/NCDFinfo: -------------------------------------------------------------------------------- 1 | Title string for 3D NetCDF file: 2 | 'Diva 3D analysis ' 3 | Reference time for data (ie: days since since 1900-01-01), if not climatological data 4 | 'months since since xxxx-01-01' 5 | Time value (that reprsents the data set), if not climatological data 6 | 1200 7 | Cell_methode string: 8 | 'time: mean (this month data from all years)' 9 | Institution name: where the dataset was produced. 10 | 'University of Liege, GeoHydrodynamics and Environment Research' 11 | Production group and e-mail 12 | 'Diva group. E-mails : a.barth@ulg.ac.be ; swatelet@ulg.ac.be' 13 | Source (observation, radiosonde, database, model-generated data,...) 14 | ' data_from various sources for diva software testing work' 15 | Comment 16 | 'No comment' 17 | Autor e-mail adress (or contact person to report problems) 18 | 'swatelet@ulg.ac.be' 19 | Acknowledgements 20 | 'No acknowledgement' 21 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/NCDFinfo: -------------------------------------------------------------------------------- 1 | Title string for 3D NetCDF file: 2 | 'Diva 3D analysis ' 3 | Reference time for data (ie: days since since 1900-01-01), if not climatological data 4 | 'months since since xxxx-01-01' 5 | Time value (that reprsents the data set), if not climatological data 6 | 1200 7 | Cell_methode string: 8 | 'time: mean (this month data from all years)' 9 | Institution name: where the dataset was produced. 10 | 'University of Liege, GeoHydrodynamics and Environment Research' 11 | Production group and e-mail 12 | 'Diva group. E-mails : a.barth@ulg.ac.be ; swatelet@ulg.ac.be' 13 | Source (observation, radiosonde, database, model-generated data,...) 14 | ' data_from various sources for diva software testing work' 15 | Comment 16 | 'No comment' 17 | Autor e-mail adress (or contact person to report problems) 18 | 'swatelet@ulg.ac.be' 19 | Acknowledgements 20 | 'No acknowledgement' 21 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvgebcomodif: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | ##################################################### 4 | # 5 | ##################################################### 6 | # 7 | mkdir -p ./3DWORK 8 | rm -f ./3DWORK/fort.44 9 | FILENAME=./input/takeout.coord 10 | if [ -f "$FILENAME" ] 11 | then 12 | echo Going to modify gebco.topo 13 | nblines=`cat './input/takeout.coord' |wc -l` 14 | ln=1 15 | # 16 | Fileinf=$FILENAME 17 | { 18 | # 19 | while [ $ln -le $nblines ] 20 | do 21 | read location 22 | echo location nbr $ln : $location 23 | echo $location > ./3DWORK/fort.44 24 | cd ./3DWORK 25 | ../../bin/gebprep.a 26 | cd .. 27 | mv ./input/modif_topo.gebco ./input/topo.gebco 28 | let ln=$(($ln+1)) 29 | done 30 | } < $Fileinf 31 | # 32 | else 33 | echo Did not find any $FILENAME file 34 | cd ./3DWORK 35 | ../../bin/gebprep.a 36 | cd .. 37 | mv ./input/modif_topo.gebco ./input/topo.gebco 38 | fi 39 | # 40 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/findca.f: -------------------------------------------------------------------------------- 1 | subroutine findca (x,y,ikn,jkn,tlcx,tlcy,tmix,tmiy,ncax,ncay) 2 | C============================================================================ 3 | real*8 x,y,tlcx,tlcy,tmix,tmiy 4 | integer ncax,ncay,ikn,jkn 5 | c include'divapre.h' 6 | c include'divainc.h' 7 | c dimension kntc(ncax,ncay,*) 8 | 9 | C IN WHICH REGION IS THE DATA? 10 | cmr ikn=((x-tmix-mod(x,tlcx))/tlcx)+1 11 | cmr jkn=((y-tmiy-mod(y,tlcy))/tlcy)+1 12 | ikn=((x-tmix-mod(x-tmix,tlcx))/tlcx)+1 13 | jkn=((y-tmiy-mod(y-tmiy,tlcy))/tlcy)+1 14 | C JMB test 15 | ikn=((x-tmix)/tlcx)+1 16 | jkn=((y-tmiy)/tlcy)+1 17 | cmr added 18 | ikn=max(1,min(ikn,ncax)) 19 | jkn=max(1,min(jkn,ncay)) 20 | c write(6,*) '????',ikn,jkn 21 | C============================================================================ 22 | return 23 | end 24 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/uur.f: -------------------------------------------------------------------------------- 1 | 2 | 3 | subroutine uur(iu,U,im,jm,valex,valrepl) 4 | real*4 U(im,jm) 5 | real*8 c8 6 | real*4 valex 7 | valex=0 8 | write(6,*) 'Going to read constraint file, size ', im,jm 9 | call ureadc(iu,c8,U,valex,ipr,imax,jmax,kmax,lw) 10 | write(6,*) 'Finished: read constraint file, size ', imax,jmax 11 | if(im.ne.imax) write(6,*) 'Problem in constraint file',iu 12 | if(jm.ne.jmax) write(6,*) 'Problem in constraint file',iu 13 | 14 | C implement it with ureadc and check for dimensions be coherent with info file 15 | c do i=1,im 16 | C read(iu,*) (U(i,j),j=1,jm) 17 | C enddo 18 | 19 | do i=1,im 20 | do j=1,jm 21 | c if(abs(U(i,j)).gt.999.) U(i,j)=0 22 | if(U(i,j).eq.valex) U(i,j)=valrepl 23 | 24 | 25 | enddo 26 | enddo 27 | return 28 | end 29 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/diva_covafit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ../output/covariance.dat -a -f ../output/covariance.dat ] 4 | then 5 | 6 | echo gnuplot is $gplot 7 | #awk '{print $0 >> "bidon"}' << EOF 8 | #the gnuplot commands 9 | 10 | echo \ 11 | "plot '../output/covariance.dat' using 1:2 with lines t 'sampled covariance', \ 12 | '../output/covariance.dat' using 1:("'$2+$4'") with lines t 'error interval on covariance', \ 13 | '../output/covariance.dat' using 1:("'$2-$4'") with lines ls 2 notitle, \ 14 | '../output/covariancefit.dat' using 1:2 with points t 'covariance used for fitting', \ 15 | '../output/covariancefit.dat' using 1:3 with lines t 'fitted Bessel covariance',\ 16 | '../output/covariance.dat' using 1:5 with points axes x1y2 t 'weights' "\ 17 | >> bidon 18 | #end gnuplot commands 19 | echo exit >> bidon 20 | 21 | 22 | $gplot bidon 23 | 24 | else 25 | echo No plot produced 26 | 27 | fi -------------------------------------------------------------------------------- /JRA4/Climatology/emobath2ghertopo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #------------------------------------------------ 4 | # Sylvain Watelet - 16/04/2016 5 | # swatelet@ulg.ac.be 6 | # 7 | # This script transforms the EMODnet bathymetry in a netcdf file (x.mnt) 8 | # into a topography in a GHER format (topo_fine.grd) + an info file 9 | # (TopoInfo_fine.dat). 10 | #------------------------------------------------ 11 | 12 | myfield="DEPTH" # name of the netcdf variable to transform 13 | ncfile="input/D3.mnt" # name of the netcdf file from EMO bath 14 | 15 | # Please CHECK offset and scale factor of the netcdf and adapt DIVA3D/src/Fortran/NC/emobath2ghertopo.f90 !!! 16 | 17 | #------------------------------------------------ 18 | # End of user changes 19 | #------------------------------------------------ 20 | 21 | echo "The field to transform is $myfield" 22 | 23 | ../../DIVA3D/bin/emobath2ghertopo.a $ncfile $myfield 24 | 25 | echo "The end." 26 | 27 | 28 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvtsdwrt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##################################################### 3 | # 4 | # 5 | Fileinf=./input/STBinfo 6 | { 7 | read comment 8 | read psal 9 | read comment 10 | read temp 11 | read comment 12 | read lay1 13 | read comment 14 | read lay2 15 | read comment 16 | read comment 17 | read comment 18 | read comment 19 | read comment 20 | read comment 21 | read comment 22 | read comment 23 | read comment 24 | read comment 25 | read comment 26 | read maxit 27 | } < $Fileinf 28 | # 29 | if [ -d ./3DWORK ]; then 30 | : 31 | else 32 | mkdir -p ./3DWORK 33 | fi 34 | cd ./3DWORK/ 35 | # 36 | if [ -f fort.44 ];then 37 | rm fort.44 38 | fi 39 | # 40 | nbfls=`cat '../input/3Dinfosalinity' |wc -l` 41 | echo $nbfls >> ./fort.44 42 | # 43 | ##if [ "$actp" == "1" ];then 44 | echo ' dvtsdwrt: Going to write TSDN2 nc file' 45 | ../../bin/dv3Dtswrt.a 46 | ##fi 47 | ##if [ "$actp" == "2" ];then 48 | ###../../bin/dv3Drstw.a 49 | ##fi 50 | cd .. 51 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/cverroraii.f: -------------------------------------------------------------------------------- 1 | real*8 err,vardata,errb 2 | 3 | 4 | 5 | err=0 6 | errb=0 7 | trace=0 8 | read(5,*) valex,cvval 9 | read(33,*) vardata 10 | i=0 11 | 101 continue 12 | 13 | read(20,*,end=200,err=200) x,y,val 14 | 15 | read(21,*,end=200,err=200) x1,y1,val1 16 | 17 | read(22,*,end=200,err=200) x2,y2,qc,aii 18 | 19 | if (abs(val-valex).gt.0.0001*abs(valex)) then 20 | if (abs(val1-valex).gt.0.0001*abs(valex)) then 21 | 22 | err=err+(val-val1)**2/(1-aii)**2 23 | errb=errb+(val-val1)**2 24 | trace=trace+Aii 25 | i=i+1 26 | endif 27 | endif 28 | goto 101 29 | 200 continue 30 | trace=trace/i 31 | write(23,999) cvval,sqrt(err/i),vardata,trace, 32 | & sqrt(errb/i),0.0,float(i) 33 | C23456 34 | 999 format(7(E11.4)) 35 | stop 36 | end 37 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvdetrend: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd divawork 3 | cp ../input/data.dat fort.88 4 | cp ../output/fieldatdatapoint.anl fort.89 5 | if [ -f ../output/diva.log ] ; then 6 | cp -f ../output/diva.log . 7 | fi 8 | ../../bin/detrend.a >> diva.log 9 | 10 | if [ $? -ne 0 ];then 11 | echo ' ' 12 | echo -------------------------------------------- 13 | echo A problem was encountered during execution ! 14 | echo divacalc: detrend.a 15 | echo Check execution track 16 | echo -------------------------------------------- 17 | echo ' ' >> diva.log 18 | echo -------------------------------------------- >> diva.log 19 | echo A problem was encountered during execution ! >> diva.log 20 | echo divacalc: detrend.a >> diva.log 21 | echo Check execution track >> diva.log 22 | echo -------------------------------------------- >> diva.log 23 | fi 24 | 25 | cp -f diva.log ../output/. 26 | cp fort.90 ../input/data.detrend.dat 27 | cp fort.97 ../output/trends.dat 28 | cd .. 29 | echo ' ' 30 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/kernelbis.inc: -------------------------------------------------------------------------------- 1 | C test divacovar 2 | 3 | if(ipipe.eq.1) then 4 | call pingpong(0,0,0) 5 | open(61,file='divapipe',form='unformatted') 6 | rewind(61) 7 | endif 8 | 9 | C0C0C0=0 10 | 11 | read(61) xjjj,yjjj,corre 12 | 13 | read(61) (tdata(i,3),i=1,ndata) 14 | if (corre.gt.1) then 15 | write(6,*) '??',ndata,xjjj,yjjj,corre 16 | write(6,*) (tdata(i,3),i=1,ndata) 17 | endif 18 | 19 | if(ipipe.eq.1) then 20 | close(61) 21 | call pingpong(0,1,0) 22 | iillmm=iillmm+1 23 | c write(6,*) '???kernel',iillmm 24 | endif 25 | 26 | 27 | do 101 i=1,ndata 28 | c read(59,*) corre 29 | C peut etre l'ordre est modifie (meme surement), indirection? 30 | C 31 | c tdata(i,3)=corre*varbak 32 | tdata(i,3)=tdata(i,3)*varbak 33 | 101 continue 34 | 35 | C write(6,*) 'Covariance retrieved',xjjj,yjjj,corre 36 | C0C0C0=corre 37 | return 38 | -------------------------------------------------------------------------------- /Example4D/input/param.par: -------------------------------------------------------------------------------- 1 | # Lc: correlation length (in units coherent with your data)# 2 | 1.5 3 | # icoordchange (=0 if no change of coordinates is to be performed; =1 if positions are in degrees and if you want to use real distances)# 4 | 2 5 | # ispec: output files required# 6 | 11 7 | # ireg: mode selected for background field: 0=null guess; 1=mean of data; 2=regression plan if at least 3 non-aligned data provided# 8 | 2 9 | # xori: x-coordinate of the first grid point of the output# 10 | 27 11 | # xori: y-coordinate of the first grid point of the output# 12 | 40 13 | # dx: step of output grid# 14 | 0.1 15 | # dy: step of output grid# 16 | 0.1 17 | # nx: number of grid points in the x-direction# 18 | 151 19 | # ny: number of grid points in the y-direction# 20 | 76 21 | # valex: exclusion value# 22 | -99 23 | # snr: signal to noise ratio of the whole dataset# 24 | 0.5 25 | # varbak: variance of the background field. If zero, no error fields are produced. If one, relative errors are obtained# 26 | 1.0 27 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/crossval: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd divawork 3 | if [ -f ../output/diva.log ] ; then 4 | cp -f ../output/diva.log . 5 | fi 6 | cp ../input/valatxy.coord fort.20 7 | cp ../output/valatxyascii.anl fort.21 8 | VALEX=$(head -22 ../input/param.par | tail -1) 9 | echo $VALEX | ../../bin/cverror.a >> diva.log 10 | if [ $? -ne 0 ];then 11 | echo ' ' 12 | echo -------------------------------------------- 13 | echo A problem was encountered during execution ! 14 | echo cverror.a 15 | echo Check execution track 16 | echo -------------------------------------------- 17 | echo ' ' >> diva.log 18 | echo -------------------------------------------- >> diva.log 19 | echo A problem was encountered during execution ! >> diva.log 20 | echo cverror.a >> diva.log 21 | echo Check execution track >> diva.log 22 | echo -------------------------------------------- >> diva.log 23 | fi 24 | echo Exclusion value used $VALEX 25 | cat fort.22 >> crossval.dat 26 | cp -f diva.log ../output/. 27 | cd .. 28 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/forgnuplotmeshl.f: -------------------------------------------------------------------------------- 1 | parameter(nm=10000000) 2 | integer*4 inode(nm) 3 | real*4 x(nm),y(nm) 4 | FAC=1 5 | read(23,*) nd1 6 | read(23,*) nd2 7 | read(23,*) nd3 8 | do i=1,nd1 9 | read(22,*) inode(i),x(i),y(i) 10 | enddo 11 | do i=1,nd2 12 | read(22,*) 13 | enddo 14 | do i=1,nd3 15 | read(22,*) i1,i2,i3,i4,i5 16 | x1=x(i1) 17 | y1=y(i1) 18 | x2=x(i3) 19 | y2=y(i3) 20 | x3=x(i5) 21 | y3=y(i5) 22 | xc=(x1+x2+x3)/3 23 | yc=(y1+y2+y3)/3 24 | 25 | x1=xc+(x1-xc)*FAC 26 | y1=yc+(y1-yc)*FAC 27 | x2=xc+(x2-xc)*FAC 28 | y2=yc+(y2-yc)*FAC 29 | x3=xc+(x3-xc)*FAC 30 | y3=yc+(y3-yc)*FAC 31 | 32 | 33 | 34 | write(71,*) x1,y1 35 | write(71,*) x2,y2 36 | write(71,*) x3,y3 37 | write(71,*) 38 | enddo 39 | stop 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/addc.f: -------------------------------------------------------------------------------- 1 | C 2 | REAL*4 V(5000000) 3 | REAL*4 W(5000000) 4 | REAL*8 W8 (1) 5 | 6 | 7 | character*100 in1,in2,out 8 | read(5,*) val 9 | C write(6,*) val, valm 10 | read(5,'(A)')in2 11 | C write(6,*) in2 12 | read(5,'(A)')out 13 | C write(6,*) out 14 | C READING U,V FIELDS --------------------------------------- 15 | 16 | open (unit=11,file=in2,form='unformatted') 17 | write(6,*) 'Going to read',in2 18 | CALL UREADC(11,W8,V,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 19 | 20 | ipr=4 21 | nw=imax*jmax 22 | do i=1,nw 23 | w(i)=valexw 24 | if (v(i).ne.valexw) then 25 | C w(i)=val+valm*V(i) 26 | C w(i)=val*exp(v(i)) 27 | w(i)=val+v(i) 28 | endif 29 | enddo 30 | open (unit=12,file=out,form='unformatted') 31 | CALL UWRITC(12,W8,W,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 32 | 33 | STOP 34 | END 35 | 36 | INCLUDE 'ureadc.f' 37 | INCLUDE 'uwritc.f' 38 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/sumc.f: -------------------------------------------------------------------------------- 1 | C 2 | REAL*4 V(5000000) 3 | REAL*4 W(5000000) 4 | REAL*8 W8(1) 5 | 6 | 7 | character*100 in1,in2,out 8 | read(5,*) val, valm 9 | C write(6,*) val, valm 10 | read(5,'(A)')in2 11 | C write(6,*) in2 12 | read(5,'(A)')out 13 | C write(6,*) out 14 | C READING U,V FIELDS --------------------------------------- 15 | 16 | open (unit=11,file=in2,form='unformatted') 17 | write(6,*) 'Going to read',in2 18 | CALL UREADC(11,W8,V,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 19 | 20 | ipr=4 21 | nw=imax*jmax 22 | do i=1,nw 23 | w(i)=valexw 24 | if (v(i).ne.valexw) then 25 | C w(i)=val+valm*V(i) 26 | C w(i)=val*exp(v(i)) 27 | w(i)=val*sqrt(amax1(0.,1.-v(i))) 28 | endif 29 | enddo 30 | open (unit=12,file=out,form='unformatted') 31 | CALL UWRITC(12,W8,W,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 32 | 33 | STOP 34 | END 35 | 36 | INCLUDE 'ureadc.f' 37 | INCLUDE 'uwritc.f' 38 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/datacheck.f: -------------------------------------------------------------------------------- 1 | C read the n contours (maximum number ncmax) 2 | integer*4 idata,idatan 3 | xmin=1E36 4 | ymin=xmin 5 | xmax=-xmin 6 | ymax=xmax 7 | read(10,*,err=999) n 8 | do i=1,n 9 | read(10,*,err=999) ii 10 | j=1 11 | 17 continue 12 | if(j.gt.ii) goto 101 13 | read(10,*,err=999) x,y 14 | j=j+1 15 | xmin=min(x,xmin) 16 | ymin=min(y,ymin) 17 | xmax=max(x,xmax) 18 | ymax=max(y,ymax) 19 | goto 17 20 | 101 continue 21 | enddo 22 | close(10) 23 | write(6,*) 'Bounding box of contours:' 24 | write(6,*) '(',xmin,',',xmax,')x(',ymin,',',ymax,')' 25 | write(6,*) 'Eliminating all data points outside this box' 26 | write(61,*) xmin 27 | write(61,*) xmax 28 | write(61,*) ymin 29 | write(61,*) ymax 30 | stop 31 | 32 | 999 continue 33 | write(6,*) 'Contour file seems corrupted' 34 | write(61,*) -1E36 35 | write(61,*) 1E36 36 | write(61,*) -1E36 37 | write(61,*) 1E36 38 | stop 39 | end 40 | 41 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/forgnuplotmesh.f: -------------------------------------------------------------------------------- 1 | parameter(nm=10000000) 2 | integer*4 inode(nm) 3 | real*4 x(nm),y(nm) 4 | FAC=1 5 | read(23,*) nd1 6 | read(23,*) nd2 7 | read(23,*) nd3 8 | do i=1,nd1 9 | read(22,*) inode(i),x(i),y(i) 10 | enddo 11 | do i=1,nd2 12 | read(22,*) 13 | enddo 14 | do i=1,nd3 15 | read(22,*) i1,i2,i3,i4,i5 16 | x1=x(i1) 17 | y1=y(i1) 18 | x2=x(i3) 19 | y2=y(i3) 20 | x3=x(i5) 21 | y3=y(i5) 22 | xc=(x1+x2+x3)/3 23 | yc=(y1+y2+y3)/3 24 | 25 | x1=xc+(x1-xc)*FAC 26 | y1=yc+(y1-yc)*FAC 27 | x2=xc+(x2-xc)*FAC 28 | y2=yc+(y2-yc)*FAC 29 | x3=xc+(x3-xc)*FAC 30 | y3=yc+(y3-yc)*FAC 31 | 32 | 33 | 34 | write(69,*) '#' 35 | write(69,*) x1,y1,0,i 36 | write(69,*) x2,y2,0,i 37 | write(69,*) 38 | write(69,*) x3,y3,0,i 39 | write(69,*) x3,y3,0,i 40 | write(69,*) 41 | write(69,*) 42 | enddo 43 | stop 44 | end 45 | 46 | 47 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvnil: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIVAWORK=./divawork 3 | export LC_ALL=C 4 | echo ////////////////////////////////////////////////// 5 | echo No data on grid: creating nil solution 6 | echo ////////////////////////////////////////////////// 7 | Filepar=./input/param.par 8 | { 9 | read linecomment 10 | read lc 11 | read linecomment 12 | read icoordchange 13 | read linecomment 14 | read ispec 15 | read linecomment 16 | read ireg 17 | read linecomment 18 | read xori 19 | read linecomment 20 | read yori 21 | read linecomment 22 | read dx 23 | read linecomment 24 | read dy 25 | read linecomment 26 | read nx 27 | read linecomment 28 | read ny 29 | read linecomment 30 | read valex 31 | read linecomment 32 | read snr 33 | read linecomment 34 | read varbak 35 | } < $Filepar 36 | if [ -f ./input/valatxy.coord ]; then 37 | awk -v valex=$valex '{print $1,$2,valex}' ./input/valatxy.coord > $DIVAWORK/fort.82 38 | fi 39 | awk -v valex=$valex '{print $1,$2,valex}' ./input/data.dat > $DIVAWORK/fort.71 40 | cp $DIVAWORK/fort.71 $DIVAWORK/fort.72 41 | cp $DIVAWORK/fort.82 $DIVAWORK/fort.73 42 | cd $DIVAWORK 43 | echo $nx $ny $valex | ../../bin/dvnil.a 44 | cd .. -------------------------------------------------------------------------------- /JRA4/Climatology/godiva: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./divadoall 2>&1 | tee divadoall.log 4 | 5 | cat divadoall.log | grep -i SEVERE > divadoall.severeerrors 6 | SEVEREERROR=$(cat divadoall.severeerrors | wc -l) 7 | 8 | cat divadoall.log | grep -vi SEVERE | grep -i -e "error " -e "error:" > divadoall.errors 9 | ERROR=$(cat divadoall.errors | wc -l) 10 | 11 | cat divadoall.log | grep -i warning > divadoall.warnings 12 | WARNING=$(cat divadoall.warnings | wc -l) 13 | 14 | echo "godiva: checking for severe errors..." 15 | if [ $SEVEREERROR -eq 0 ] 16 | then 17 | echo "godiva: no severe error." 18 | else 19 | echo "godiva: $SEVEREERROR SEVERE ERROR(S), please check divadoall.severeerrors and divadoall.log !!" 20 | fi 21 | 22 | echo "godiva: checking for other errors..." 23 | if [ $ERROR -eq 0 ] 24 | then 25 | echo "godiva: no other error." 26 | else 27 | echo "godiva: $ERROR other ERROR(S), please check divadoall.errors and divadoall.log !!" 28 | fi 29 | 30 | echo "godiva: checking for warnings..." 31 | if [ $WARNING -eq 0 ] 32 | then 33 | echo "godiva: no warning." 34 | else 35 | echo "godiva: $WARNING WARNING(S), please check divadoall.warnings and divadoall.log !!" 36 | fi 37 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/NC/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the Diva code 2 | 3 | sources := $(wildcard *.f *F) 4 | sources90 := $(filter-out divaio.F90,$(wildcard *.f90 *F90)) 5 | executables := $(addprefix $(BINDIR),$(patsubst %.f,%.a,$(patsubst %.F,%.a,$(sources)))) 6 | executables90 := $(addprefix $(BINDIR),$(patsubst %.f90,%.a,$(patsubst %.F90,%.a,$(sources90)))) 7 | 8 | all : divaio.o $(executables) $(executables90) 9 | 10 | divaio.o : divaio.F90 11 | $(compiler) $(ncinc) $(nocyg) -c divaio.F90 12 | 13 | $(executables): | $(BINDIR) 14 | 15 | $(BINDIR): 16 | $(MKDIR) $(BINDIR) 17 | 18 | $(BINDIR)%.a : %.f 19 | $(compiler) $(nocyg) -o $@ $< $(nclib) $(ncinc) 20 | 21 | $(BINDIR)%.a : %.F 22 | $(compiler) $(nocyg) -o $@ $< $(nclib) $(ncinc) 23 | 24 | $(BINDIR)%.a : %.f90 divaio.o 25 | $(compiler) $(ncinc) $(nocyg) $< -o $@ divaio.o $(nclib) 26 | 27 | $(BINDIR)%.a : %.F90 divaio.o 28 | $(compiler) $(ncinc) $(nocyg) $< -o $@ divaio.o $(nclib) 29 | 30 | # Utility targets 31 | .PHONY: cleanall cleanobj cleanexec 32 | 33 | cleanall : cleanobj cleanexec 34 | 35 | cleanobj : 36 | rm *.o *.mod 37 | 38 | cleanexec : 39 | rm $(executables) $(executables90) 40 | 41 | 42 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/README.md: -------------------------------------------------------------------------------- 1 | The Fortran sources are organised in different sub-directories (Calc, Mesh, ...). 2 | 3 | To compile the code you have two main possibilities: 4 | 5 | 1. Use the *divacompileall* script: 6 | 1. edit *divacompile_options* according to your installation (compiler, libraries etc), 7 | 2. run script `divacompileall`. 8 | 9 | A file *compilation.log* summarises the result of the compilation (number of executables etc). 10 | 11 | 2. Use the *Makefile* 12 | 1. edit the file 'Makefile' 13 | 2. run `make` or `make all` 14 | 15 | In both cases you need to have the netCDF library installed. 16 | Following the procedures from 17 | * http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html (netCDF C library) and 18 | * http://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html (netCDF Fortran). 19 | 20 | Once these are installed, you should get the possibility to use the tools *nc-config* and *nf-config*, which allow you to determine 21 | * the locations of the netCDF include directory: 22 | `nf-config --flibs` 23 | * the library directories: 24 | `nf-config --fflags` 25 | * the Fortran compiler: 26 | `nf-config --fc` 27 | 28 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/userfunc.F: -------------------------------------------------------------------------------- 1 | ************************************************************************ 2 | SUBROUTINE USERFUN(nblines,VARVAL) 3 | ************************************************************************ 4 | ! 5 | IMPLICIT NONE 6 | ! 7 | INTEGER :: n,i,nblines 8 | REAL :: VAL 9 | ! REAL, DIMENSION(:), ALLOCATABLE :: VARVAL 10 | REAL, DIMENSION(nblines) :: VARVAL 11 | ! ALLOCATE(VARVAL(nblines) 12 | 13 | ! DO n = 1,nblines 14 | ! VAL = my_transformation(VARVAL(n)) 15 | ! VARVAL(n) = VAL 16 | ! ENDDO 17 | 18 | RETURN 19 | END 20 | 21 | ************************************************************************ 22 | SUBROUTINE USERINV(nblines,VARVAL) 23 | ************************************************************************ 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | INTEGER :: n,i,nblines 28 | REAL :: VAL 29 | ! REAL, DIMENSION(:), ALLOCATABLE :: VARVAL 30 | REAL, DIMENSION(nblines) :: VARVAL 31 | ! ALLOCATE(VARVAL(nblines) 32 | 33 | ! DO n = 1,nblines 34 | ! VAL = my_inverse_transformation(VARVAL(n)) 35 | ! VARVAL(n) = VAL 36 | ! ENDDO 37 | RETURN 38 | END 39 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvsample: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd divawork 3 | cp ../input/data.dat.ori fort.20 4 | nbcol=$(head -1 fort.20 | wc -w) 5 | echo $2 $nbcol 6 | ndata=$(cat fort.20 | wc -l) 7 | echo Subsampling of $1 from $ndata data points >> ../output/diva.log 8 | if [ "$1" -ge "$ndata" ] 9 | then 10 | echo subsample size too large 11 | else 12 | echo $1 $ndata $2 $nbcol | ../../bin/subsampling.a >> ../output/diva.log 13 | if [ $? -ne 0 ];then 14 | echo ' ' 15 | echo -------------------------------------------- 16 | echo A problem was encountered during execution ! 17 | echo subsampling.a 18 | echo Check execution track 19 | echo -------------------------------------------- 20 | echo ' ' >> ../output/diva.log 21 | echo -------------------------------------------- >> ../output/diva.log 22 | echo A problem was encountered during execution ! >> ../output/diva.log 23 | echo subsampling.a >> ../output/diva.log 24 | echo Check execution track >> ../output/diva.log 25 | echo -------------------------------------------- >> ../output/diva.log 26 | fi 27 | fi 28 | mv -f fort.44 ../input/data.dat 29 | mv -f fort.45 ../input/valatxy.coord 30 | rm -f fort.20 31 | echo New data and reference data ready >> ../output/diva.log 32 | cd .. 33 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/tomvec.f: -------------------------------------------------------------------------------- 1 | C2345678901234567890123456789012345678901234567890123456789012345678901 2 | SUBROUTINE TOMVEC(A,B,C,F,X,IMAXD,IMIN,IMAX,KMAX) 3 | C ====== 4 | C>>>>>RESOUD DES SYSTEMES TRIDIAGONAUX D"UNE MANIERE VECTORISABLE<<<<< 5 | C ATTENTION, LE SYTEME EST DE LA FORME B Y + (1+A) Y + C Y 6 | C 7 | IMPLICIT NONE 8 | INTEGER*4 i,k,km1,kp1,kmxm1,imin,imax,imaxd,kmax 9 | REAL*8 A(IMAXD,*),B(IMAXD,*),C(IMAXD,*),F(IMAXD,*),X(IMAXD,*) 10 | C 11 | C 12 | DO 20 K=2,KMAX 13 | KM1=K-1 14 | DO 10 I=IMIN,IMAX 15 | B(I,K)=B(I,K)/( A(I,KM1)+1.D0) 16 | 10 CONTINUE 17 | DO 20 I=IMIN,IMAX 18 | A(I,K)=A(I,K)-B(I,K)*C(I,KM1) 19 | 20 CONTINUE 20 | C 21 | C 22 | DO 30 K=2,KMAX 23 | KM1=K-1 24 | DO 30 I=IMIN,IMAX 25 | F(I,K)=F(I,K)-B(I,K)*F(I,KM1) 26 | 30 CONTINUE 27 | C 28 | DO 40 I=IMIN,IMAX 29 | X(I,KMAX)=F(I,KMAX)/( A(I,KMAX)+1.D0) 30 | 40 CONTINUE 31 | C 32 | KMXM1=KMAX-1 33 | DO 50 K=KMXM1,1,-1 34 | KP1=K+1 35 | DO 50 I=IMIN,IMAX 36 | X(I,K)=(F(I,K)-C(I,K)*X(I,KP1))/( A(I,K)+1.D0) 37 | 50 CONTINUE 38 | C 39 | RETURN 40 | END 41 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/3Dinfosalinity: -------------------------------------------------------------------------------- 1 | ! Variable 2 | psal.xxxxxxxx.0404 3 | ! Number of the first level to be processed 4 | 1 5 | ! Number of the last level to be processed 6 | 25 7 | ! coast contour generation 8 | 0 9 | ! data cleaning 10 | 4 11 | ! parameters optimisation 12 | -30 13 | ! perform 3D analysis 14 | 1 15 | ! Min value for correlation lenght 16 | 0.1 17 | ! Max value for correlation lenght 18 | 3 19 | ! Min value for S/N 20 | 1 21 | ! Max value for S/N 22 | 20 23 | !gp 24 | 0 25 | !gp 26 | 0 27 | !gp 28 | 42 29 | # Title string for salinity 3D NetCDF file: 30 | 'Diva 3D analysis of salinity variable' 31 | ! Variable long name string 32 | 'Salinity' 33 | ! variable units string 34 | 'psu' 35 | !pararam clim 36 | 1 37 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 38 | 'months since since 1900-01-01' 39 | # Time value (that reprsents the data set), if not climatological data 40 | 1200 41 | # Cell_methode string: 42 | 'time: mean (month 02 data from all years)' 43 | # Institution name: where the dataset was produced. 44 | 'ULg_GHER' 45 | # Production group and date 46 | 'Diva group' 47 | # Source (observation, radiosonde, database, model-generated data,...) 48 | 'Medar merged data' 49 | #Comment 50 | 'No comment' 51 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/3Dinfotemper: -------------------------------------------------------------------------------- 1 | ! Variable 2 | temp.xxxxxxxx.0404 3 | ! Number of the first level to be processed 4 | 1 5 | ! Number of the last level to be processed 6 | 25 7 | ! coast contour generation 8 | 0 9 | ! data cleaning 10 | 4 11 | ! parameters optimisation 12 | -30 13 | ! perform 3D analysis 14 | 1 15 | ! Min value for correlation lenght 16 | 0.1 17 | ! Max value for correlation lenght 18 | 3 19 | ! Min value for S/N 20 | 1 21 | ! Max value for S/N 22 | 20 23 | !gp 24 | 0 25 | !gp 26 | 0 27 | !gp 28 | 32 29 | # Title string for temperature 3D NetCDF file: 30 | 'Diva 3D analysis of temperature variable' 31 | ! Variable long name string 32 | 'Temperature' 33 | ! variable units string 34 | 'degree_C' 35 | !param clim 36 | 1 37 | # Reference time for data (ie: days since since 1900-01-01), if not climatological data 38 | 'months since since 1900-01-01' 39 | # Time value (that reprsents the data set), if not climatological data 40 | 1200 41 | # Cell_methode string: 42 | 'time: mean (month 02 data from all years)' 43 | # Institution name: where the dataset was produced. 44 | 'ULg_GHER' 45 | # Production group and date 46 | 'Diva group' 47 | # Source (observation, radiosonde, database, model-generated data,...) 48 | 'Medar merged data' 49 | #Comment 50 | 'No comment' 51 | -------------------------------------------------------------------------------- /JRA4/Climatology/gebcoprep.example: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | export LC_ALL=C 4 | echo ========================================================================== 5 | echo Preparing gebco file for diva 6 | echo Cleaning up header and putting decimal dots 7 | echo ========================================================================== 8 | 9 | # eliminates header, changes sign of column 3 and replaces commas by dots 10 | 11 | mkdir -p input 12 | 13 | awk -F " " \ 14 | '{if($1 !~ /^[a-zA-Z]/) print $1,$2,-$3}' topogebco.asc | sed s/,/./g > ./input/topo.gebco 15 | 16 | # Now eliminate region y> 57+0.6x (Norwegian coast) 17 | 18 | #awk -F " " '{{if ($2 > 57.0+0.6*$1) {x=-10.} else {x=$3} } print $1,$2,x}' ./input/topo.gebco > bidon 19 | #mv bidon ./input/topo.gebco 20 | #awk -F " " '{{if ($1 < 10) {x=-10.} else {x=$3} } print $1,$2,x}' ./input/topo.gebco > bidon 21 | #mv bidon ./input/topo.gebco 22 | 23 | # Now you can use gebco2diva possibly with subsampling values gebco2diva 10 5 (1 on 10 in x , 1 on 5 in y) 24 | echo ========================================================================== 25 | echo You can now use gebco2diva in directory divastripped 26 | echo To to so, load your data of ./input into divastripped/input and proceed 27 | echo ========================================================================== 28 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/wclfile.F: -------------------------------------------------------------------------------- 1 | ! 2 | PROGRAM WCLFILE 3 | ! 4 | ! 5 | implicit none 6 | ! 7 | !------------------------------------------------------------ 8 | ! 9 | INTEGER :: istep,MINLEV,MAXLEV 10 | INTEGER :: nlev 11 | ! 12 | REAL :: rmin,rmax 13 | ! 14 | CHARACTER (len=8) :: VARFILEIN,comments 15 | CHARACTER (len=15) :: EXECIN 16 | CHARACTER (len=31) :: VARFINFO 17 | !------------------------------------------------------------ 18 | ! 19 | VARFILEIN = 'cl.1xxxx' 20 | VARFINFO = '../input/divaparam/CLminmax' 21 | ! 22 | EXECIN='../input/3Dinfo' 23 | OPEN(2,FILE=EXECIN,STATUS='OLD') 24 | READ(2,*)! comments 25 | READ(2,*)! comments 26 | READ(2,*)! comments 27 | READ(2,*) MINLEV 28 | READ(2,*)! comments 29 | READ(2,*) MAXLEV 30 | CLOSE(2) 31 | ! 32 | OPEN(2,FILE=VARFINFO,STATUS='OLD') 33 | DO nlev = 1,MINLEV-1 34 | READ(2,*) rmin,rmax 35 | ENDDO 36 | DO istep = MINLEV,MAXLEV 37 | READ(2,*) rmin,rmax 38 | WRITE(VARFILEIN(5:8),'(I4.4)') istep 39 | OPEN(3,FILE=VARFILEIN) 40 | WRITE(3,*) rmin 41 | WRITE(3,*) rmax 42 | CLOSE(3) 43 | ENDDO 44 | CLOSE(2) 45 | ! 46 | stop 47 | end 48 | 49 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/calcmu.f: -------------------------------------------------------------------------------- 1 | xi=1 2 | read(5,*,end=99) RL,SNR, nbcol,xi 3 | 99 continue 4 | write(6,*) 'To calculate data weights, using' 5 | write(6,*) 'Length scale,SNR,xi', RL, SNR,xi 6 | w=1 7 | unsk=16*Atan(1.0) 8 | 9 | if(abs(xi).gt.1.) then 10 | angle=log(abs(xi)+sqrt(xi*xi-1)) 11 | if (angle.eq.0.) then 12 | unsk=16*Atan(1.0) 13 | else 14 | unsk=16*Atan(1.0)*sinh(angle)/angle 15 | endif 16 | endif 17 | 18 | if(abs(xi).le.1) then 19 | angle=acos(xi) 20 | if (angle.eq.0.) then 21 | unsk=16*Atan(1.0) 22 | else 23 | unsk=16*Atan(1.0)*sin(angle)/angle 24 | endif 25 | endif 26 | 27 | if (nbcol.eq.3) then 28 | 29 | write(6,*) 'Data, 3 columns, hence without relative weights' 30 | 150 continue 31 | read(44,*,end=200) x,y,val 32 | C write(6,*) x,y,val,w 33 | write(20,*) x,y,val,w*unsk*SNR/(RL*RL) 34 | c write(20,*) x,y,val,w*8*SNR/(RL*RL) 35 | goto 150 36 | 37 | else 38 | 39 | write(6,*) 'Data, 4 columns, using relative weights' 40 | 160 continue 41 | read(44,*,end=200) x,y,val,w 42 | C write(6,*) x,y,val,w 43 | write(20,*) x,y,val,w*unsk*SNR/(RL*RL) 44 | c write(20,*) x,y,val,w*8*SNR/(RL*RL) 45 | goto 160 46 | 47 | endif 48 | 49 | 200 continue 50 | stop 51 | end 52 | 53 | 54 | -------------------------------------------------------------------------------- /JRA4/Climatology/input/SDN_L56.list: -------------------------------------------------------------------------------- 1 | SDN:L056:3:357 = acoustic tracking systems 2 | SDN:L056:3:POS01 = Decca Navigator System main chain receivers 3 | SDN:L056:3:POS02 = Global Navigation Satellite System receivers 4 | SDN:L056:3:POS03 = NAVSTAR Global Positioning System receivers 5 | SDN:L056:3:POS04 = Differential Global Positioning System receivers 6 | SDN:L056:3:POS05 = Long Range Navigation version C receivers 7 | SDN:L056:3:POS06 = Marine chronometers 8 | SDN:L056:3:POS07 = Sextants 9 | SDN:L056:3:POS08 = Decca Navigator System HiFix receivers 10 | SDN:L056:3:POS09 = Toran receivers 11 | SDN:L056:3:POS10 = Automatic Ranging Grid Overlay DM 54 receivers 12 | SDN:L056:3:POS11 = Trident receivers 13 | SDN:L056:3:POS12 = Système leger de measure de distance receivers 14 | SDN:L056:3:POS13 = Rana receivers 15 | SDN:L056:3:POS14 = Pulse8 receivers 16 | SDN:L056:3:POS15 = Omega receivers 17 | SDN:L056:3:POS16 = Argos GPS-localised transmitters 18 | SDN:L056:3:POS17 = Argos doppler-localised transmitters 19 | SDN:L056:3:POS18 = Navy Navigation Satellite System receivers 20 | SDN:L056:3:POS19 = inertial navigation systems 21 | SDN:L056:3:POS20 = Motorola Mini-Ranger receivers 22 | SDN:L056:3:POS21 = Hyperfix receivers 23 | SDN:L056:3:POS22 = Trisponder navigation systems 24 | SDN:L056:3:POS23 = radio tracking systems 25 | SDN:L056:3:POS24 = dead reckoning 26 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/wsnfile.F: -------------------------------------------------------------------------------- 1 | ! 2 | PROGRAM WSNFILE 3 | ! 4 | ! 5 | implicit none 6 | ! 7 | !-------------------------------------------------------------- 8 | ! 9 | INTEGER :: ivar, istep,MINLEV,MAXLEV 10 | INTEGER :: nlev 11 | ! 12 | REAL :: rmin,rmax 13 | ! 14 | CHARACTER (len=8) :: VARFILEIN,comments 15 | CHARACTER (len=15) :: EXECIN 16 | CHARACTER (len=31) :: VARFINFO 17 | !-------------------------------------------------------------- 18 | ! 19 | VARFILEIN = 'sn.1xxxx' 20 | VARFINFO = '../input/divaparam/SNminmax' 21 | ! 22 | EXECIN='../input/3Dinfo' 23 | OPEN(2,FILE=EXECIN,STATUS='OLD') 24 | READ(2,*) comments 25 | READ(2,*) comments 26 | READ(2,*) comments 27 | READ(2,*) MINLEV 28 | READ(2,*) comments 29 | READ(2,*) MAXLEV 30 | CLOSE(2) 31 | ! 32 | OPEN(2,FILE=VARFINFO,STATUS='OLD') 33 | DO nlev = 1,MINLEV-1 34 | READ(2,*) rmin,rmax 35 | ENDDO 36 | DO istep = MINLEV,MAXLEV 37 | READ(2,*) rmin,rmax 38 | WRITE(VARFILEIN(5:8),'(I4.4)') istep 39 | OPEN(3,FILE=VARFILEIN) 40 | WRITE(3,*) rmin 41 | WRITE(3,*) rmax 42 | CLOSE(3) 43 | ENDDO 44 | CLOSE(2) 45 | ! 46 | stop 47 | end 48 | 49 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divacont2grid: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ' ' 3 | echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | echo %% Try to translate contours into gridded format %%% 5 | echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | cp ./input/TopoInfo.dat ./divawork/fort.13 7 | cp ./input/coast.cont ./divawork/fort.10 8 | cd ./divawork 9 | if [ -f ../output/diva.log ] ; then 10 | cp -f ../output/diva.log . 11 | fi 12 | ../../bin/cont2grid.a >> diva.log 13 | if [ $? -ne 0 ];then 14 | echo ' ' 15 | echo -------------------------------------------- 16 | echo A problem was encountered during execution ! 17 | echo divacont2grid: cont2grid.a 18 | echo Check execution track 19 | echo -------------------------------------------- 20 | echo ' ' >> diva.log 21 | echo -------------------------------------------- >> diva.log 22 | echo A problem was encountered during execution ! >> diva.log 23 | echo divacont2grid: cont2grid.a >> diva.log 24 | echo Check execution track >> diva.log 25 | echo -------------------------------------------- >> diva.log 26 | fi 27 | cp -f diva.log ../output/. 28 | cp -v fort.99 ../output/topomask.grd 29 | rm -f fort13 30 | rm -f fort.10 31 | rm -f fort.99 32 | rm -f fort.66 33 | if [ "$1" == "-r" ] 34 | then 35 | echo Placing new contour file as input 36 | cp -v ../output/topomask.grd ../input/topomask.grd 37 | fi 38 | cd .. 39 | -------------------------------------------------------------------------------- /.github/workflows/github-actions-demo.yml: -------------------------------------------------------------------------------- 1 | name: DIVA compilation 2 | on: [push] 3 | jobs: 4 | Compilation: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Install Dependencies 8 | run: | 9 | sudo apt-get update 10 | sudo apt-get install -y software-properties-common 11 | sudo add-apt-repository universe 12 | sudo apt-get install -y wget make gfortran netcdf-bin libnetcdf-dev libnetcdff-dev 13 | - name: Download DIVA 14 | env: 15 | DIVA_VERSION: 4.7.2 16 | TOOLSDIR: "/tmp/tools/" 17 | run: | 18 | echo "Installing DIVA software" 19 | mkdir -pv ${TOOLSDIR} 20 | cd ${TOOLSDIR} 21 | wget -q "https://github.com/gher-uliege/DIVA/archive/refs/tags/v${DIVA_VERSION}.tar.gz" 22 | tar xvf "v${DIVA_VERSION}.tar.gz" 23 | - name: Compilation 24 | env: 25 | DIVA_VERSION: 4.7.2 26 | TOOLSDIR: "/tmp/tools/" 27 | run: | 28 | cd ${TOOLSDIR}/DIVA-${DIVA_VERSION}/DIVA3D/src/Fortran/ 29 | make 30 | - name: Test code 31 | env: 32 | DIVA_VERSION: 4.7.2 33 | TOOLSDIR: "/tmp/tools/" 34 | run: | 35 | export PATH=.:${PATH} 36 | echo "This is the PATH variable: ${PATH}" 37 | cd ${TOOLSDIR}/DIVA-${DIVA_VERSION}/DIVA3D/divastripped/ 38 | ./divatest0 39 | -------------------------------------------------------------------------------- /JRA4/Climatology/divaduplicatesODV4: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #set -x # to debug 4 | 5 | export LC_ALL=C # to get the same sorting order on different systems 6 | 7 | ############################################################################ 8 | # Sylvain Watelet - 28/10/2013 # 9 | # Handling of duplicates input data # 10 | ############################################################################ 11 | 12 | saveifs=$IFS 13 | IFS=$'\n' 14 | for var in `cat varlist` 15 | do 16 | for year in `cat yearlist` 17 | do 18 | for month in `cat monthlist` 19 | do 20 | lev="0" 21 | for layer in `cat input/contour.depth` 22 | do 23 | let lev=$(($lev+1)) 24 | let lnum=$((10000+$lev)) 25 | datafile="input/divadata/"${var}".${year}.${month}.${lnum}" 26 | echo "Checking for duplicates in" $datafile ... 27 | cp $datafile ${datafile}"_bkp" 28 | datafile_tmp=${datafile}"_tmp" 29 | rm -f $datafile_tmp 30 | cat $datafile | sort -u -k 1,9 >> $datafile_tmp # to remove duplicate lines (fields 1 to 9 are considered) 31 | n_old=$(cat $datafile | wc -l) 32 | n_new=$(cat $datafile_tmp | wc -l) 33 | n_dup=$(($n_old - $n_new)) 34 | echo $n_dup "duplicates in this file" 35 | rm $datafile 36 | mv $datafile_tmp $datafile 37 | 38 | done 39 | done 40 | 41 | done 42 | done 43 | IFS=$saveifs 44 | 45 | 46 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/mathpr.f: -------------------------------------------------------------------------------- 1 | C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | C 3 | C SUBROUTINE LIST: 4 | C - MATHPR (MODULE) 5 | C 6 | C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 8 | C C 9 | C MATHPR MODULE C 10 | C Description of the mathematical problem C 11 | C C 12 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 13 | subroutine mathpr(ipr) 14 | include'divapre.h' 15 | #include "divainc.h" 16 | C 17 | C input of general data 18 | C 19 | read(10,*) ityp 20 | if(ipr.gt.0) write(6,*) ' Finite Element type =',ityp 21 | read(10,*) isym 22 | if(ipr.gt.0) write(6,*) ' Symetric problem : isym =',isym 23 | read(10,*) ipb 24 | if(ipr.gt.0) write(6,*) ' Problem type : ipb =',ipb 25 | C 26 | C PROBLEM P2: (see: BRASSEUR, Ph.D. Dissertation, 1993) 27 | C 28 | if(ipb.eq.2) then 29 | read(12,*) alpha0 30 | read(12,*) alpha1 31 | if(ipr.gt.0) write(6,*) ' Parameter alpha0 =',alpha0 32 | if(ipr.gt.0) write(6,*) ' Parameter alpha1 =',alpha1 33 | endif 34 | return 35 | end 36 | -------------------------------------------------------------------------------- /JRA4/Climatology/gebcomodif: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WDIR=$(pwd) 4 | DIVADIR="../../DIVA3D/divastripped" 5 | 6 | if [ -f ./input/topogebco.asc ];then 7 | 8 | # eliminates header, changes sign of column 3 and replaces commas by dots 9 | 10 | awk -F " " \ 11 | '{if($1 !~ /^[a-zA-Z]/) print $1,$2,-$3}' ./input/topogebco.asc | sed s/,/./g > ./input/topo.gebco 12 | 13 | echo Modified topo is in input/topo.gebco 14 | 15 | fi 16 | 17 | if [ -f ./input/topo.gebco ];then 18 | ################################################## 19 | 20 | cp ./input/topo.gebco ${DIVADIR}/input/. 21 | 22 | if [ -f ./input/takeout.coord ];then 23 | cp ./input/takeout.coord ${DIVADIR}/input/. 24 | fi 25 | cd ${DIVADIR} 26 | # loop on coordinates in takeout.coord if any 27 | 28 | ./dvgebcomodif 29 | 30 | if [ "$#" == "2" ];then 31 | nx=$1 32 | ny=$2 33 | ./gebco2diva $nx $ny 34 | else 35 | ./gebco2diva 36 | fi 37 | mv $WDIR/input/topo.gebco $WDIR/input/topo.gebco.ori 38 | mv ${DIVADIR}/input/topo.gebco $WDIR/input/topo.gebco 39 | mv ${DIVADIR}/output/topo.grd $WDIR/input/topo.grd 40 | mv ${DIVADIR}/output/TopoInfo.dat $WDIR/input/. 41 | 42 | echo '======================================================================' 43 | echo 'Finished modifying topo.gebco, ' 44 | echo 'Original topo.gebco is in input/topo.gebco.ori' 45 | echo 'Modified topo.gebco, topo.grd andTopoInfo.dat are in input/.' 46 | echo '======================================================================' 47 | 48 | fi 49 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvstbdat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # prepares diva layers input data 4 | # 5 | ##################################################### 6 | #first layer to be prossessed 7 | bottm=$1 8 | #last layer to be prossessed 9 | surf=$2 10 | var1=$3 11 | var2=$4 12 | ##################################################### 13 | # 14 | dep=$bottm 15 | # 16 | cd ./3DWORK/ 17 | cp ../input/STBinfo . 18 | # 19 | DATADir=./data 20 | # 21 | if [ -d $DATADir ];then 22 | rm -rf $DATADir 23 | fi 24 | mkdir -p $DATADir 25 | # 26 | if [ -f fort.44 ];then 27 | rm fort.44 28 | fi 29 | # 30 | let lev=$((10000+$surf)) 31 | # 32 | cp ../input/divadata/$var1.$lev fort.44 33 | nbccol=`head -n 1 ./fort.44 | wc -w` 34 | rm fort.44 35 | echo $bottm >> ./fort.44 36 | echo $surf >> ./fort.44 37 | echo $nbccol >> ./fort.44 38 | ../../bin/datapre.a 39 | # 40 | while [ $dep -le $surf ] 41 | do 42 | # 43 | let lev=$((10000+$dep)) 44 | if [ -f ./data/$var1.$lev ] ; then 45 | cp -v ../input/divadata/$var1.$lev ../input/divadata/$var1.$lev.beforstb 46 | cp -v ./data/$var1.$lev ../input/divadata/$var1.$lev 47 | cp -v ./data/$var1.$lev.info ../input/divadata/$var1.$lev.info 48 | fi 49 | if [ -f ./data/$var2.$lev ] ; then 50 | cp -v ../input/divadata/$var2.$lev ../input/divadata/$var2.$lev.beforstb 51 | cp -v ./data/$var2.$lev ../input/divadata/$var2.$lev 52 | cp -v ./data/$var2.$lev.info ../input/divadata/$var2.$lev.info 53 | fi 54 | dep=`expr $dep + 1` 55 | done 56 | cd ../ 57 | #echo data ready for analysis 58 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/lincom.f: -------------------------------------------------------------------------------- 1 | C 2 | REAL*4 U(5000000) 3 | REAL*4 V(5000000) 4 | REAL*8 W8(1) 5 | 6 | 7 | CALL UREADC(10,W8,U,VALEXU,IPR,IMAX,JMAX,KMAX,NW) 8 | CALL UREADC(11,W8,V,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 9 | read(20,*) a1,b1 10 | read(20,*) a2,b2 11 | read(20,*) a3,b3 12 | read(20,*) a4,b4 13 | ipr=4 14 | nw=imax*jmax 15 | C valexw = valexu 16 | WRITE(6,*) ' VALEUR D EXCLUSION POUR B: ',VALEXU 17 | WRITE(6,*) ' VALEUR D EXCLUSION POUR X: ',VALEXW 18 | 19 | call usum(u,v,valexu,imax,jmax,kmax,a1,b1,a2,b2, 20 | & a3,b3,a4,b4) 21 | CALL UWRITC(12,W8,U,VALEXU,IPR,IMAX,JMAX,KMAX,NW) 22 | CALL UWRITC(13,W8,V,VALEXU,IPR,IMAX,JMAX,KMAX,NW) 23 | STOP 24 | END 25 | 26 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 27 | subroutine usum(u,v,valexu,imax,jmax,kmax,a1,b1,a2,b2, 28 | & a3,b3,a4,b4) 29 | real*4 u(imax,jmax,kmax),v(imax,jmax,kmax) 30 | do k=1,kmax 31 | do j=1,jmax 32 | do i=1,imax 33 | if(u(i,j,k).ne.valexu) then 34 | rr=u(i,j,k)+a1*v(i,j,k)+b1 35 | tt=v(i,j,k)+a2*u(i,j,k)+b2 36 | u(i,j,k)=rr*b3+a3 37 | v(i,j,k)=tt*b4+a4 38 | endif 39 | enddo 40 | enddo 41 | enddo 42 | return 43 | end 44 | INCLUDE '../Extensions/ureadc.f' 45 | INCLUDE '../Extensions/uwritc.f' 46 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/addgridc.f: -------------------------------------------------------------------------------- 1 | integer XM 2 | parameter(XM=10000000) 3 | real*4 A(XM),B(XM),C(XM) 4 | 5 | read(5,*,end=200) valex,M,N 6 | read(5,*) val 7 | valm=0 8 | 9 | call RDMAT(A,M,N,M,20) 10 | 11 | call msum(A,B,C,N,M,valex,val,valm) 12 | call IMPMAT(C,M,N,M,22) 13 | 200 continue 14 | stop 15 | end 16 | subroutine msum(A,B,C,N,M,valex,val,valm) 17 | real*4 A(N,M),B(N,M),C(N,M) 18 | do i=1,M 19 | do j=1,N 20 | vals=val+A(i,j) 21 | if(abs(A(i,j)-valex).lt.0.00001*abs(valex)) vals=valex 22 | C(i,j)=vals 23 | enddo 24 | enddo 25 | return 26 | end 27 | 28 | 29 | SUBROUTINE IMPMAT(A,L,M,NDIM,IUCT) 30 | C ================================== 31 | 32 | DIMENSION A(NDIM,M) 33 | K=1 34 | 1 KK=K+7 35 | IF (KK.LE.M) goto 3 36 | 2 KK=M 37 | 3 WRITE(IUCT,200) 0,(J,J=K,KK) 38 | DO 4 I=1,L 39 | 4 WRITE(IUCT,201) I,(A(I,J),J=K,KK) 40 | K=K+8 41 | IF (K.LE.M) goto 1 42 | 5 RETURN 43 | 200 FORMAT(I3,8(9X,I3,3X)) 44 | 201 FORMAT(1X,I3,8(E15.5)) 45 | END 46 | 47 | 48 | SUBROUTINE RDMAT(A,L,M,NDIM,IUCT) 49 | C ================================== 50 | 51 | DIMENSION A(NDIM,M) 52 | K=1 53 | 1 KK=K+7 54 | IF (KK.LE.M) goto 3 55 | 2 KK=M 56 | 3 READ(IUCT,200) 57 | DO 4 I=1,L 58 | 4 READ(IUCT,201) II,(A(I,J),J=K,KK) 59 | K=K+8 60 | IF (K.LE.M) goto 1 61 | 5 RETURN 62 | 200 FORMAT(I3,8(9X,I3,3X)) 63 | 201 FORMAT(1X,I3,8(E15.5)) 64 | END 65 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dv3d2stb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #first layer to be processed 4 | bottm=$1 5 | #last layer to be processed 6 | surf=$2 7 | temp=$3 8 | psal=$4 9 | actp=$5 10 | acts=$6 11 | ########################################## 12 | # 13 | mkdir -p ./output/3Danalysis/Before_stab 14 | # 15 | let lev1=$((10000+$bottm)) 16 | let lev2=$((10000+$surf)) 17 | if [ "$actp" == "1" ]; then 18 | mv ./output/3Danalysis/$temp'.'$lev1'.'$lev2'.anl.nc' ./output/3Danalysis/Before_stab/. 19 | else 20 | mv ./output/3Danalysis/$temp'.'$lev1'.'$lev2'.ref.nc' ./output/3Danalysis/Before_stab/. 21 | dep=$bottm 22 | while [ $dep -le $surf ] 23 | do 24 | let level=$((10000+$dep)) 25 | cp -v './output/3Danalysis/Fields/'$temp'.'$level'.ref' './output/3Danalysis/Fields/'$temp'.'$level'.anl' 26 | cp -v './output/3Danalysis/Fields/'$temp'.'$level'.ref.error' './output/3Danalysis/Fields/'$temp'.'$level'.error' 27 | dep=`expr $dep + 1` 28 | done 29 | fi 30 | if [ "$acts" == "1" ]; then 31 | mv ./output/3Danalysis/$psal'.'$lev1'.'$lev2'.anl.nc' ./output/3Danalysis/Before_stab/. 32 | else 33 | mv ./output/3Danalysis/$psal'.'$lev1'.'$lev2'.ref.nc' ./output/3Danalysis/Before_stab/. 34 | dep=$bottm 35 | while [ $dep -le $surf ] 36 | do 37 | let level=$((10000+$dep)) 38 | cp -v './output/3Danalysis/Fields/'$psal'.'$level'.ref' './output/3Danalysis/Fields/'$psal'.'$level'.anl' 39 | cp -v './output/3Danalysis/Fields/'$psal'.'$level'.ref.error' './output/3Danalysis/Fields/'$psal'.'$level'.error' 40 | dep=`expr $dep + 1` 41 | done 42 | fi 43 | mv ./output/3Danalysis/TEMP_SAL_*.nc ./output/3Danalysis/Before_stab/. 44 | mv ./output/3Danalysis/GnuPlots ./output/3Danalysis/Before_stab/. 45 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/sumgridc.f: -------------------------------------------------------------------------------- 1 | integer XM 2 | parameter(XM=10000000) 3 | real*4 A(XM),B(XM),C(XM) 4 | 5 | read(5,*,end=200) valex,M,N 6 | read(5,*) val, valm 7 | 8 | 9 | call RDMAT(A,M,N,M,20) 10 | 11 | call msum(A,B,C,N,M,valex,val,valm) 12 | call IMPMAT(C,M,N,M,22) 13 | 200 continue 14 | stop 15 | end 16 | subroutine msum(A,B,C,N,M,valex,val,valm) 17 | real*4 A(N,M),B(N,M),C(N,M) 18 | do i=1,M 19 | do j=1,N 20 | vals=val*sqrt(amax1(0.,1.-A(i,j))) 21 | if(abs(A(i,j)-valex).lt.0.00001*abs(valex)) vals=valex 22 | C(i,j)=vals 23 | enddo 24 | enddo 25 | return 26 | end 27 | 28 | 29 | SUBROUTINE IMPMAT(A,L,M,NDIM,IUCT) 30 | C ================================== 31 | 32 | DIMENSION A(NDIM,M) 33 | K=1 34 | 1 KK=K+7 35 | IF (KK.LE.M) goto 3 36 | 2 KK=M 37 | 3 WRITE(IUCT,200) 0,(J,J=K,KK) 38 | DO 4 I=1,L 39 | 4 WRITE(IUCT,201) I,(A(I,J),J=K,KK) 40 | K=K+8 41 | IF (K.LE.M) goto 1 42 | 5 RETURN 43 | 200 FORMAT(I3,8(9X,I3,3X)) 44 | 201 FORMAT(1X,I3,8(E15.5)) 45 | END 46 | 47 | 48 | SUBROUTINE RDMAT(A,L,M,NDIM,IUCT) 49 | C ================================== 50 | 51 | DIMENSION A(NDIM,M) 52 | K=1 53 | 1 KK=K+7 54 | IF (KK.LE.M) goto 3 55 | 2 KK=M 56 | 3 READ(IUCT,200) 57 | DO 4 I=1,L 58 | 4 READ(IUCT,201) II,(A(I,J),J=K,KK) 59 | K=K+8 60 | IF (K.LE.M) goto 1 61 | 5 RETURN 62 | 200 FORMAT(I3,8(9X,I3,3X)) 63 | 201 FORMAT(1X,I3,8(E15.5)) 64 | END 65 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvgetpar: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | if [ "$#" != "1" ] 5 | then 6 | echo '==========================================' 7 | echo Usage: 8 | echo ' ' dvchpar parameter value 9 | echo Example: change signal/noise ratio to 0.1 10 | echo ' ' dvchpar SNR 0.1 11 | echo '==========================================' 12 | 13 | exit 14 | fi 15 | 16 | 17 | 18 | 19 | if [ "$1" == "LC" ]||[ "$1" == "lc" ]||[ "$1" == "length" ]||[ "$1" == "CL" ]||[ "$1" == "cl" ] 20 | then 21 | il=2 22 | fi 23 | 24 | if [ "$1" == "icoordchange" ]||[ "$1" == "icoord" ]||[ "$1" == "ICOORD" ] 25 | then 26 | il=4 27 | fi 28 | 29 | if [ "$1" == "ispec" ]||[ "$1" == "ISPEC" ] 30 | then 31 | il=6 32 | fi 33 | 34 | if [ "$1" == "ireg" ]||[ "$1" == "IREG" ] 35 | then 36 | il=8 37 | fi 38 | 39 | if [ "$1" == "xori" ]||[ "$1" == "XORI" ]||[ "$1" == "x1" ] 40 | then 41 | il=10 42 | fi 43 | 44 | if [ "$1" == "yori" ]||[ "$1" == "YORI" ]||[ "$1" == "y1" ] 45 | then 46 | il=12 47 | fi 48 | 49 | if [ "$1" == "dx" ]||[ "$1" == "DX" ] 50 | then 51 | il=14 52 | fi 53 | 54 | if [ "$1" == "dy" ]||[ "$1" == "DY" ] 55 | then 56 | il=16 57 | fi 58 | 59 | 60 | if [ "$1" == "nx" ]||[ "$1" == "NX" ] 61 | then 62 | il=18 63 | fi 64 | 65 | if [ "$1" == "ny" ]||[ "$1" == "NY" ] 66 | then 67 | il=20 68 | fi 69 | 70 | 71 | if [ "$1" == "valex" ]||[ "$1" == "VALEX" ] 72 | then 73 | il=22 74 | fi 75 | 76 | 77 | if [ "$1" == "SNR" ] 78 | then 79 | il=24 80 | fi 81 | 82 | 83 | if [ "$1" == "varbak" ]||[ "$1" == "VARBAK" ]||[ "$1" == "VARBACK" ]||[ "$1" == "varback" ] 84 | then 85 | il=26 86 | fi 87 | 88 | head -$il ./input/param.par | tail -1 89 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/NC/netcdfobsid.F90: -------------------------------------------------------------------------------- 1 | ! netcdfobsid adds coordinates of observations (longitude, latitude, depth and 2 | ! time) and observation identifier to an existing netCDF file 3 | ! 4 | ! Call as 5 | ! netcdfobsid 6 | ! 7 | ! obsid.txt: text file with 5 columns: longitude (degrees north), latitude 8 | ! (degrees east), depth (meters, positive in water) and time 9 | ! (yyyy-mm-ddTHH:MM:SS, seconds, minutes and hours might be omitted) and id 10 | ! separated by space. The id cannot contain any space. The time or the time and 11 | ! depth column can be omitted. 12 | ! 13 | ! file.nc: netCDF file where the information is appended (file must exist) 14 | ! 15 | ! Compile with something like: 16 | ! 17 | ! gfortran $(nf-config --fflags) -o netcdfobsid divaio.F90 netcdfobsid.F90 \ 18 | ! $(nf-config --flibs) 19 | ! 20 | 21 | #define ERROR_STOP call exit(1) 22 | #define check(status) call check_error(status,__FILE__,__LINE__) 23 | 24 | 25 | program netcdfobsid 26 | use divaio 27 | implicit none 28 | 29 | character(len=maxlen) :: file,ncfile 30 | real(8), pointer :: coord(:,:) 31 | character(len=maxlen), pointer :: ids(:) 32 | integer :: iargc, unit = 10 33 | 34 | if (iargc().ne.2) then 35 | write(0,*) 'Usage: netcdfobsid ' 36 | ERROR_STOP 37 | end if 38 | 39 | call getarg(1,file) 40 | call getarg(2,ncfile) 41 | 42 | call loadObsFile(file,unit,coord,ids) 43 | call saveNCObsFile(ncfile,coord,ids) 44 | 45 | deallocate(coord,ids) 46 | 47 | end program netcdfobsid 48 | 49 | ! LocalWords: netcdfobsid obsid txt nc netcdf gfortran config fflags 50 | ! LocalWords: flibs str Fliegel Flandern jd ModifiedJulianDay 51 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/sumgrid.f: -------------------------------------------------------------------------------- 1 | integer XM 2 | parameter(XM=10000000) 3 | real*4 A(XM),B(XM),C(XM) 4 | 5 | read(5,*,end=200) valex,M,N 6 | call RDMAT(A,M,N,M,20) 7 | call RDMAT(B,M,N,M,21) 8 | call msum(A,B,C,N,M,valex) 9 | call IMPMAT(C,M,N,M,22) 10 | 200 continue 11 | stop 12 | end 13 | subroutine msum(A,B,C,N,M,valex) 14 | c real*4 A(N,M),B(N,M),C(N,M) 15 | real*4 A(M,N),B(M,N),C(M,N) 16 | do i=1,M 17 | do j=1,N 18 | val=A(i,j)+B(i,j) 19 | if(abs(A(i,j)-valex).lt.0.00001*abs(valex)) val=valex 20 | if(abs(B(i,j)-valex).lt.0.00001*abs(valex)) val=valex 21 | C(i,j)=val 22 | enddo 23 | enddo 24 | return 25 | end 26 | 27 | 28 | SUBROUTINE IMPMAT(A,L,M,NDIM,IUCT) 29 | C ================================== 30 | 31 | DIMENSION A(NDIM,M) 32 | K=1 33 | 1 KK=K+7 34 | IF (KK.LE.M) goto 3 35 | 2 KK=M 36 | 3 WRITE(IUCT,200) (J,J=K,KK) 37 | DO 4 I=1,L 38 | 4 WRITE(IUCT,201) I,(A(I,J),J=K,KK) 39 | K=K+8 40 | IF (K.LE.M) goto 1 41 | 5 RETURN 42 | 200 FORMAT('0',8(9X,I3,3X)) 43 | 201 FORMAT(1X,I3,8(E15.5)) 44 | END 45 | 46 | 47 | SUBROUTINE RDMAT(A,L,M,NDIM,IUCT) 48 | C ================================== 49 | 50 | DIMENSION A(NDIM,M) 51 | K=1 52 | 1 KK=K+7 53 | IF (KK.LE.M) goto 3 54 | 2 KK=M 55 | 3 READ(IUCT,200) 56 | DO 4 I=1,L 57 | 4 READ(IUCT,201) II,(A(I,J),J=K,KK) 58 | K=K+8 59 | IF (K.LE.M) goto 1 60 | 5 RETURN 61 | c 200 FORMAT('0',8(9X,I3,3X)) 62 | 200 FORMAT(I3,3X,8(9X,I3,3X)) 63 | 201 FORMAT(1X,I3,8(E15.5)) 64 | END 65 | -------------------------------------------------------------------------------- /JRA4/Climatology/divacutNCDF: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #------------------------------------------------ 4 | # Sylvain Watelet - 17/07/2015 5 | # swatelet@ulg.ac.be 6 | # 7 | # Cut 4D netcdf using a contour file 8 | #------------------------------------------------ 9 | 10 | #------------------------------------------------ 11 | # START OF USER SETTINGS 12 | #------------------------------------------------ 13 | 14 | ncfile="./output/3Danalysis/Salinity.4Danl.nc" # path to input 4D netcdf file 15 | contfile="./input/cutNCDF.cont" # path to contour file 16 | outfile="./output/3Danalysis/Salinity.4Danl.cut.nc" # path to output 4D netcdf cut file 17 | 18 | #------------------------------------------------ 19 | # END OF USER SETTINGS !!!!! 20 | #------------------------------------------------ 21 | 22 | echo "#####################" 23 | echo "Start of divacutNCDF" 24 | echo "#####################" 25 | 26 | nx=`ncdump -h $ncfile | head -3 | tail -1` 27 | nx=${nx:6:${#nx}-7} 28 | ny=`ncdump -h $ncfile | head -4 | tail -1` 29 | ny=${ny:6:${#ny}-7} 30 | nz=`ncdump -h $ncfile | head -5 | tail -1` 31 | nz=${nz:8:${#nz}-9} 32 | nt=`ncdump -h $ncfile | head -6 | tail -1` 33 | nt=${nt:7:${#nt}-8} 34 | echo "dimensions are : "$nx,$ny,$nz,$nt 35 | 36 | obs=`ncdump -h $ncfile | head -8 | tail -1` 37 | obs=${obs:15:${#obs}-16} 38 | #echo $obs 39 | idlen=`ncdump -h $ncfile | head -9 | tail -1` 40 | idlen=${idlen:8:${#idlen}-9} 41 | #echo $idlen 42 | 43 | flags='-O3 -cpp -DDIVAITERATIVE ' 44 | ncinc=`nc-config --fflags` 45 | nclib=`nc-config --flibs` 46 | 47 | ../../DIVA3D/bin/test_inpolygon.a $ncfile $contfile $outfile $nx $ny $nz $nt $obs $idlen 48 | 49 | echo "###################" 50 | echo "End of divacutNCDF" 51 | echo "###################" 52 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/sum.f: -------------------------------------------------------------------------------- 1 | C 2 | REAL*4 U(5000000) 3 | REAL*4 V(5000000) 4 | REAL*4 W(5000000) 5 | REAL*8 W8(1) 6 | 7 | 8 | character*100 in1,in2,out 9 | read(5,'(A)')in1 10 | read(5,'(A)')in2 11 | read(5,'(A)')out 12 | C READING U,V FIELDS --------------------------------------- 13 | 14 | open (unit=10,file=in1,form='unformatted') 15 | open (unit=11,file=in2,form='unformatted') 16 | write(6,*) 'Going to read',in1 17 | CALL UREADC(10,W8,U,VALEXU,IPR,IMAX,JMAX,KMAX,NW) 18 | write(6,*) 'Going to read',in2 19 | CALL UREADC(11,W8,V,VALEXW,IPR,IMAX,JMAX,KMAX,NW) 20 | 21 | ipr=4 22 | nw=imax*jmax 23 | C valexw = valexu 24 | WRITE(6,*) ' VALEUR D EXCLUSION POUR B: ',VALEXU 25 | WRITE(6,*) ' VALEUR D EXCLUSION POUR X: ',VALEXW 26 | 27 | call usum(u,v,w,valexu,imax,jmax,kmax,valexw) 28 | open (unit=12,file=out,form='unformatted') 29 | CALL UWRITC(12,W8,W,VALEXU,IPR,IMAX,JMAX,KMAX,NW) 30 | 31 | STOP 32 | END 33 | 34 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 35 | subroutine usum(u,v,w,valexu,imax,jmax,kmax,valexw) 36 | real*4 u(imax,jmax,kmax),v(imax,jmax,kmax) 37 | real*4 w(imax,jmax,kmax) 38 | 39 | do k=1,kmax 40 | do j=1,jmax 41 | do i=1,imax 42 | w(i,j,k)=valexu ! instead of u(i,j,k) 43 | if ((u(i,j,k).ne.valexu).and.(v(i,j,k).ne.valexw)) 44 | & w(i,j,k)=u(i,j,k)+v(i,j,k) 45 | enddo 46 | enddo 47 | enddo 48 | 49 | return 50 | end 51 | INCLUDE 'ureadc.f' 52 | INCLUDE 'uwritc.f' 53 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/filtercv.f: -------------------------------------------------------------------------------- 1 | integer iw 2 | parameter(iw=1000000) 3 | real*4 cv(iw),cvf(iw),w(iw) 4 | real*4 w1(iw),w2(iw),w3(iw),w4(iw),w5(iw) 5 | 6 | 7 | read(5,*) nsamp,nlayer 8 | write(6,*) 'CV',nsamp,nlayer 9 | 10 | call filtercv(cv,cvf,w,nsamp,nlayer,w1,w2,w3,w4,w5) 11 | stop 12 | end 13 | subroutine filtercv(cv,cvf,w,ns,nl,w1,w2,w3,w4,w5) 14 | real*4 cv(ns,nl) 15 | real*4 cvf(ns,nl) 16 | real*4 w(ns,nl) 17 | real*4 w1(ns,nl) 18 | real*4 w2(ns,nl) 19 | real*4 w3(ns,nl) 20 | real*4 w4(ns,nl) 21 | real*4 w5(ns,nl) 22 | do j=1,nl 23 | do i=1,ns 24 | read(20,*,end=99,err=99) 25 | & w1(i,j),cv(i,j),w2(i,j),w3(i,j),w4(i,j),w5(i,j),w(i,j) 26 | enddo 27 | enddo 28 | do kk=1,3 29 | do j=1,nl 30 | do i=1,ns 31 | jp=min(j+1,nl) 32 | jm=max(j-1,1) 33 | a=sqrt(w(i,jp)/(w(i,j)+w(i,jp))) 34 | b=sqrt(w(i,jm)/(w(i,j)+w(i,jm))) 35 | cvf(i,j)=cv(i,j) 36 | & +0.25*(a*(cv(i,jp)-cv(i,j))-b*(cv(i,j)-cv(i,jm))) 37 | enddo 38 | enddo 39 | do j=1,nl 40 | do i=1,ns 41 | cv(i,j)=cvf(i,j) 42 | enddo 43 | enddo 44 | 45 | 46 | enddo 47 | 48 | do j=1,nl 49 | do i=1,ns 50 | write(21,60) 51 | & w1(i,j),cvf(i,j),w2(i,j),w3(i,j),w4(i,j),w5(i,j),w(i,j) 52 | enddo 53 | enddo 54 | 55 | 56 | 60 Format(7(E12.5)) 57 | return 58 | 99 continue 59 | write(6,*) 'Invalid input file' 60 | stop 61 | end 62 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/topoprep.f: -------------------------------------------------------------------------------- 1 | read(10,*) 2 | write(11,*) 3 | read(10,*) RL 4 | write(11,*) RL 5 | read(10,*) 6 | write(11,*) 7 | read(10,*) IC 8 | write(11,*) IC 9 | read(10,*) 10 | write(11,*) 11 | read(10,*) IC 12 | write(11,*) IC 13 | read(10,*) 14 | write(11,*) 15 | read(10,*) IC 16 | IS=0 17 | write(11,*) IS 18 | read(10,*) 19 | write(11,*) 20 | read(10,*) x1 21 | write(11,*) x1 22 | read(10,*) 23 | write(11,*) 24 | read(10,*) y1 25 | write(11,*) y1 26 | read(10,*) 27 | write(11,*) 28 | read(10,*) dx 29 | write(11,*) dx 30 | read(10,*) 31 | write(11,*) 32 | read(10,*) dy 33 | write(11,*) dy 34 | read(10,*) 35 | write(11,*) 36 | read(10,*) M 37 | write(11,*) M 38 | read(10,*) 39 | write(11,*) 40 | read(10,*) N 41 | write(11,*) N 42 | read(10,*) 43 | write(11,*) 44 | read(10,*) R 45 | write(11,*) R 46 | read(10,*) 47 | write(11,*) 48 | read(10,*) SN 49 | write(11,*) SN 50 | read(10,*) 51 | write(11,*) 52 | read(10,*) vv 53 | ii=0 54 | write(11,*) ii 55 | 56 | 57 | 58 | 59 | 60 | write(20,*) x1 61 | write(20,*) y1 62 | write(20,*) dx 63 | write(20,*) dy 64 | write(20,*) M 65 | write(20,*) N 66 | c make large enough grid 67 | write(30,*) 1 68 | write(30,*) 4 69 | write(30,*) x1-dx,y1-dx 70 | write(30,*) x1+M*dx,y1-dy 71 | write(30,*) x1+M*dx,y1+N*dy 72 | write(30,*) x1-dx,y1+N*dy 73 | write(30,*) 74 | 75 | stop 76 | end 77 | 78 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divacoa2cont: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | infolog -- 6 | infolog "Try to translate ODV contours into DIVA format" 7 | infolog -- 8 | 9 | if [ -f ./input/coast.coa ]; then 10 | Filepar=./input/param.par 11 | { 12 | read linecomment 13 | read lc 14 | read linecomment 15 | read icoordchange 16 | read linecomment 17 | read ispec 18 | read linecomment 19 | read ireg 20 | read linecomment 21 | read xori 22 | read linecomment 23 | read yori 24 | read linecomment 25 | read dx 26 | read linecomment 27 | read dy 28 | read linecomment 29 | read nx 30 | read linecomment 31 | read ny 32 | read linecomment 33 | read valex 34 | read linecomment 35 | read snr 36 | read linecomment 37 | read varbak 38 | } < $Filepar 39 | echo $xori > ./divawork/fort.13 40 | echo $yori >> ./divawork/fort.13 41 | echo $dx >> ./divawork/fort.13 42 | echo $dy >> ./divawork/fort.13 43 | echo $nx >> ./divawork/fort.13 44 | echo $ny >> ./divawork/fort.13 45 | cp ./input/coast.coa ./divawork/fort.10 46 | cd ./divawork 47 | if [ -f ../output/diva.log ] ; then 48 | cp -f ../output/diva.log . 49 | fi 50 | ../../bin/coatocont.a >> ${divalog} 51 | cp -f diva.log ../output/. 52 | cp -v fort.99 ../output/coast.cont 53 | cp -v fort.67 ../output/coast.cont.odv 54 | rm -f fort13 55 | rm -f fort.10 56 | rm -f fort.99 57 | rm -f fort.66 58 | if [ "$1" == "-r" ]; then 59 | divaecho Placing new contour file as input 60 | cp -v ../output/coast.cont ../input/coast.cont 61 | fi 62 | cd .. 63 | else 64 | warnlog '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' 65 | warnlog '%%% Sorry, need an ODV coast.coa file %%%%%%%%%%%%' 66 | warnlog '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' 67 | fi 68 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/kernel.inc: -------------------------------------------------------------------------------- 1 | C test divacovar 2 | C0C0C0=0 3 | C Uncomment line when full kernel to be tested 4 | c goto 1122 5 | C write(6,*) '???OP',xob,yob 6 | rewind(57) 7 | rewind(58) 8 | close(57) 9 | close(58) 10 | if(ikern.ne.1) then 11 | write(6,*) 'NDATA',ndata,ikern 12 | do i=1,ndata 13 | xjj=tdata(i,1) 14 | yjj=tdata(i,2) 15 | c write(6,*) 'kelos',l(lkelos+i-1) 16 | if (icoordchange.ne.0) call xyll(xjj,yjj) 17 | write(58,*) xjj,yjj 18 | C write(6,*) xjj,yjj 19 | enddo 20 | close(58) 21 | ikern=1 22 | c stop 23 | endif 24 | C back to real coordinates 25 | xjj=xob 26 | yjj=yob 27 | if (icoordchange.ne.0) call xyll(xjj,yjj) 28 | C normally only water points are analysed 29 | rlm=rl0 30 | if (icoordchange.ne.0) rlm=rlm/dykm 31 | forw=4*3.1415926536/rlm/rlm 32 | C uses S/N=1 33 | write(6,*) 34 | write(6,*) 35 | write(6,*) 'Kernel calculation==============' 36 | write(6,*) 'Covariances with point',xjj,yjj 37 | write(57,*) xjj,yjj,1,forw 38 | close(57) 39 | call system("bash ../dvcovar") 40 | rewind(59) 41 | do 101 i=1,ndata 42 | read(59,*) xjjj,yjjj,corre 43 | c if(yob.lt.-4.99) write(6,*) '???',xjjj,yjjj,corre 44 | c if(corre.gt.1) then 45 | c if(corre.lt.100) then 46 | c write(6,*) '???CORRE???',corre,xjj,yjj,xjjj,yjjj 47 | c corre=1 48 | c endif 49 | c endif 50 | tdata(i,3)=corre*varbak 51 | 101 continue 52 | close(59) 53 | rewind(61) 54 | read(61,*) xjjj,yjjj,corre 55 | write(6,*) 'Covariance retrieved',xjjj,yjjj,corre 56 | C0C0C0=corre 57 | close(61) 58 | write(6,*) 'Kernel calculation finished=====' 59 | write(6,*) 60 | return 61 | 1122 continue -------------------------------------------------------------------------------- /JRA4/Climatology/divaguessformsODV4: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | if [ "$#" != "1" ] 5 | then 6 | echo "=======================================" 7 | echo "Usage: divaguessform datafile" 8 | echo "=======================================" 9 | exit 10 | fi 11 | 12 | # First try to determine which delimiter by testing which one gives the 13 | # maximum number of equal number of fields on the lines 14 | 15 | NTABS=$(awk -F "\t" 'BEGIN {n=0;NFO=0} {if(substr($0,1,2) != "//") { if (NF==NFO) {n=n+NF} else {NFO=NF}}} END {print n+NF}' $1) 16 | NSEMI=$(awk -F ";" 'BEGIN {n=0;NFO=0} {if(substr($0,1,2) != "//") { if (NF==NFO) {n=n+NF} else {NFO=NF}}} END {print n+NF}' $1) 17 | delimiter="\t" 18 | echo $NTABS and $NSEMI 19 | 20 | if [ "$NSEMI" -gt "$NTABS" ] 21 | then 22 | delimiter=";" 23 | fi 24 | 25 | echo "$delimiter" > ODVdelimiter 26 | 27 | awk -F "$delimiter" '{\ 28 | if(substr($0,1,2) != "//" && /ongitude/) { print $0 } 29 | }' $1 > ODVheader 30 | 31 | awk -F "$delimiter" '{\ 32 | for(i=1;i<=NF;i++){{print $i "\t \t" i} } 33 | }' ODVheader > ODVcolumns 34 | 35 | #### 36 | # Handling of end-of-line character problems (Sylvain Watelet - 29/08/2013) 37 | z=$(awk -F "$delimiter" '{print NF}' ODVheader) 38 | m=0 39 | 40 | m=$(awk -F "$delimiter" 'NF>0 { 41 | for (i=1;i<=NF;i++) { 42 | if($i != "Longitude [degrees_east]") {m=m+1} else {m=0} 43 | } 44 | } 45 | END {print m ; 46 | } ' ODVheader) 47 | 48 | echo $m, $z 49 | #m=14 50 | 51 | if [ -n "$m" ] # verification of the existence of $m (in case of other problems linked to the file reading) 52 | then 53 | true # no problem 54 | else 55 | echo "$1" >> ODVerrorfiles # problem 56 | exit 57 | fi 58 | 59 | if [ $m -eq $z ] 60 | then 61 | #echo $m 62 | echo "$1" >> ODVerrorfiles 63 | else 64 | true # rm -f ODVerrorfiles 65 | fi 66 | 67 | #### 68 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divaclean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | infolog -- 6 | infolog "Cleaning up intermediate files" 7 | infolog -- 8 | 9 | divaecho ' ' 10 | divaecho Making directories 11 | divaecho ' ' 12 | 13 | mkdir -p ./divawork 14 | mkdir -p ./meshgenwork 15 | mkdir -p ./output 16 | mkdir -p ./input 17 | mkdir -p ./output/ghertonetcdf 18 | mkdir -p ./output/meshvisu 19 | mkdir -p ./gnuwork 20 | 21 | divaecho 'Cleaning divawork and gnuwork directory' 22 | divaecho ' ' 23 | rm -f ./divawork/fort.* 24 | rm -f ./divawork/dvping 25 | rm -f ./divawork/dvpong 26 | rm -f ./divawork/divapipe 27 | rm -f ./divawork/*.stackdump 28 | rm -f ./gnuwork/*.stackdump 29 | rm -f ./gnuwork/fort.* 30 | rm -f ./gnuwork/plots/* 31 | rm -f ./divawork/sub/* 32 | rm -f ./divawork/coast.cont* # Removing old contours 33 | 34 | divaecho 'Removing log files' 35 | divaecho ' ' 36 | rm -f ./logs/*log 37 | rm -f ./divawork/*.log # Remove all log files? 38 | 39 | divaecho Cleaning meshgenwork directory 40 | divaecho ' ' 41 | rm -f ./meshgenwork/fort.* 42 | rm -f ./meshgenwork/diva.log 43 | divaecho Cleaning output directory 44 | divaecho ' ' 45 | 46 | rm -f ./output/meshvisu/fort.* 47 | rm -f ./output/*.anl 48 | rm -f ./output/ghertonetcdf/GridInfo.dat 49 | rm -f ./output/ghertonetcdf/fort.* 50 | rm -f ./output/ghertonetcdf/diva.log 51 | rm -f ./output/*.dat 52 | rm -f ./output/*.nc 53 | rm -f ./output/*.ref 54 | 55 | divaecho Looking for density file... 56 | divaecho ' ' 57 | 58 | if [ -f ./input/coast.cont.dens ]; then 59 | warnline 60 | warnlog "... there is a coast.cont.dens file" 61 | warnlog "Are you sure you provided it for this application?" 62 | echo ' ' 63 | warnline 64 | warnlog "In any case, make sure the input files in ./input are OK" 65 | echo 66 | warline 67 | else 68 | warnlog "... there is no density file" 69 | fi 70 | 71 | infolog -- 72 | infolog Cleaning is finished 73 | infolog -- 74 | -------------------------------------------------------------------------------- /JRA4/Climatology/diva4Dclean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | datadir='./input/divadata/' 5 | paramdir='./input/divaparam/' 6 | UVdir='./input/UVcons/' 7 | outputdir='./output/' 8 | workdir='./Datawork/' 9 | 10 | echo ' ' 11 | 12 | case $1 in 13 | 14 | # 1. Delete everything 15 | #------------------------------------------------------------- 16 | 17 | -all) echo -n 'Going to clean everything:' 18 | echo ' ' 19 | echo 'Cleaning input directories (1/3): divadata' 20 | rm -rf $datadir 21 | echo 'Cleaning input directories (2/3): divaparam' 22 | rm -rf $paramdir 23 | echo 'Cleaning input directories (3/3): divaUVcons' 24 | rm -rf $UVdir 25 | 26 | echo ' ' 27 | echo 'Removing newinput directory' 28 | rm -rf ./newinput/ 29 | 30 | echo ' ' 31 | echo 'Cleaning output directory' 32 | rm -rf $outputdir 33 | 34 | echo ' ' 35 | echo 'Creating output directory structure' 36 | mkdir -pv $outputdir/{3Danalysis,ghertonetcdf,meshvisu} 37 | 38 | echo ' ' 39 | echo 'Cleaning Datawork directory' 40 | rm -rf $workdir 41 | 42 | ;; 43 | 44 | # 2. Working directory 45 | #--------------------------------------------------------------- 46 | -work) echo -n 'clean work' 47 | echo ' ' 48 | echo 'Cleaning Datawork directory' 49 | rm -rf $workdir 50 | ;; 51 | 52 | # 3. Input directory 53 | #--------------------------------------------------------------- 54 | 55 | -input) echo -n 'clean input' 56 | echo 'Cleaning input directories (1/3): divadata' 57 | rm -rf $datadir 58 | echo 'Cleaning input directories (2/3): divaparam' 59 | rm -rf $paramdir 60 | echo 'Cleaning input directories (3/3): divaUVcons' 61 | rm -rf $UVdir 62 | 63 | echo ' ' 64 | echo 'Removing newinput directory' 65 | rm -rf ./newinput/ 66 | ;; 67 | 68 | 69 | # 4. Other cases 70 | *) echo 'Usage: diva4Dclean -option' 71 | echo 'with option = all, input or work';; 72 | 73 | esac 74 | 75 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvicemask: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ' ' 3 | echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | echo %% Try to translate contours into gridded format %%% >> ./output/diva.log 5 | echo %% Try to translate contours into gridded format %%% 6 | echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | cp ./output/ghertonetcdf/GridInfo.dat ./divawork/fort.13 8 | cp ./input/iceedge.dat ./divawork/fort.10 9 | cp ./output/fieldgher.anl ./divawork/fort.98 10 | cd ./divawork 11 | ../../bin/cont2grid.a >> ../output/diva.log 12 | if [ $? -ne 0 ];then 13 | echo ' ' 14 | echo -------------------------------------------- 15 | echo A problem was encountered during execution ! 16 | echo dvicemask: cont2grid.a 17 | echo Check execution track 18 | echo -------------------------------------------- 19 | echo ' ' >> ../output/diva.log 20 | echo -------------------------------------------- >> ../output/diva.log 21 | echo A problem was encountered during execution ! >> ../output/diva.log 22 | echo dvicemask: cont2grid.a >> ../output/diva.log 23 | echo Check execution track >> ../output/diva.log 24 | echo -------------------------------------------- >> ../output/diva.log 25 | fi 26 | ../../bin/ghermask.a >> ../output/diva.log 27 | if [ $? -ne 0 ];then 28 | echo ' ' 29 | echo -------------------------------------------- 30 | echo A problem was encountered during execution ! 31 | echo dvicemask: ghermask.a 32 | echo Check execution track 33 | echo -------------------------------------------- 34 | echo ' ' >> ../output/diva.log 35 | echo -------------------------------------------- >> ../output/diva.log 36 | echo A problem was encountered during execution ! >> ../output/diva.log 37 | echo dvicemask: ghermask.a >> ../output/diva.log 38 | echo Check execution track >> ../output/diva.log 39 | echo -------------------------------------------- >> ../output/diva.log 40 | fi 41 | cd .. 42 | rm -f ./output/fieldgher.anl 43 | cp -v ./divawork/fort.97 ./output/fieldgher.anl -------------------------------------------------------------------------------- /DIVA3D/divastripped/dv4DncYRwrt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # WRITES 4D netCDF multi-year climatology FILE 4 | # 5 | ##################################################### 6 | # 7 | # 8 | var="$1" 9 | echo 'Writing 4D NETCDF multi-year climatology file for' "$var" 10 | nbmon=`cat ./input/monthlist |wc -l` 11 | # 12 | if [ -f ./3DWORK/fort.44 ];then 13 | rm fort.44 14 | fi 15 | # 16 | rm -f ./3DWORK/3Dncliste 17 | nbfls=0 18 | ######################################################### 19 | saveifs=$IFS 20 | IFS=$'\n' 21 | for year in `cat ./input/yearlist` 22 | ######################################################### 23 | do 24 | # 25 | nblns=`cat ./output/3Danalysis/"$var".$year.3DNCliste |wc -l` 26 | Fileinf='./output/3Danalysis/'"$var"'.'$year'.3DNCliste' 27 | { 28 | ll=1 29 | while [ $ll -le $nblns ] 30 | do 31 | read filename 32 | echo $filename >> ./3DWORK/3Dncliste 33 | let ll=$(($ll+1)) 34 | done 35 | } < "$Fileinf" 36 | # 37 | let nbfls=$(($nbfls+$nblns)) 38 | done 39 | IFS=$saveifs 40 | # 41 | head -12 './output/3Danalysis/'"$var"'.'$year'.3DNCinfo' > ./3DWORK/3DNCinfo 42 | 43 | for year in `cat ./input/yearlist` 44 | ######################################################### 45 | do 46 | # 47 | Fileinf='./output/3Danalysis/'"$var"'.'$year'.3DNCinfo' 48 | { 49 | read dummy 50 | read dummy 51 | read dummy 52 | read dummy 53 | read dummy 54 | read dummy 55 | read dummy 56 | read dummy 57 | read dummy 58 | read dummy 59 | read dummy 60 | read dummy 61 | ll=1 62 | while [ $ll -le $nbmon ]; do 63 | read comm1 64 | echo $comm1 >> ./3DWORK/3DNCinfo 65 | read comm2 66 | echo $comm2 >> ./3DWORK/3DNCinfo 67 | read comm3 68 | echo $comm3 >> ./3DWORK/3DNCinfo 69 | let ll=$(($ll+1)) 70 | done 71 | # 72 | } < "$Fileinf" 73 | # 74 | done 75 | # 76 | # 77 | echo $nbfls > ./3DWORK/fort.44 78 | # 79 | cd ./3DWORK/ 80 | ../../bin/dv4DYRstr.a 81 | cd .. 82 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvoutlierclean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | echo ======================================================== 4 | echo Going to clean data points that are considered outliers 5 | echo Using outliersbis.normalized.dat 6 | echo Need to change if divaqc or divaqcter 7 | echo ======================================================== 8 | dvoutliercleanlog=./output/dvoutlierclean.log 9 | echo ======================================================== > $dvoutliercleanlog 10 | echo Going to clean data points that are considered outliers >> $dvoutliercleanlog 11 | echo Using outliersbis.normalized.dat >> $dvoutliercleanlog 12 | echo Need to change if divaqc or divaqcter >> $dvoutliercleanlog 13 | echo ======================================================== >> $dvoutliercleanlog 14 | # 15 | if [ -f ./output/outliersbis.normalized.dat ] 16 | then 17 | awk -v valex=$valex 'NR==FNR {s[i++]=$0; isok[i-1]=1; next} { if ( $1+0. > 4.0 ) {xx=int($2-1);isok[xx]=0}; j=0} END {j=0; while(j < i) { if (isok[j]==1) print s[j];j=j+1} } ' ./input/data.dat ./output/outliersbis.normalized.dat > ./input/data.dat.nooutliers 18 | echo Before cleaning >> $dvoutliercleanlog 19 | wc -l ./input/data.dat >> $dvoutliercleanlog 20 | echo After cleaning of points outside of the mesh >> $dvoutliercleanlog 21 | wc -l ./input/data.dat.nooutliers >> $dvoutliercleanlog 22 | echo Before cleaning 23 | wc -l ./input/data.dat 24 | echo After cleaning of points outside of the mesh 25 | wc -l ./input/data.dat.nooutliers 26 | if [ "$1" == "-r" ] 27 | then 28 | mv -v ./input/data.dat ./input/data.dat.withoutliers 29 | mv -v ./input/data.dat.nooutliers ./input/data.dat 30 | fi 31 | else 32 | echo ==================================== >> $dvoutliercleanlog 33 | echo Sorry, no outlier detection was done >> $dvoutliercleanlog 34 | echo ==================================== >> $dvoutliercleanlog 35 | echo ==================================== 36 | echo Sorry, no outlier detection was done 37 | echo ==================================== 38 | fi 39 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvstbchp: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | if [ $1 == "1" ];then 5 | cp -v ./input/param.par ./input/param.par.stb 6 | # 7 | Fileinf='./input/param.par' 8 | { 9 | read comment1 10 | read param1 11 | read comment2 12 | read param2 13 | read comment3 14 | read param3 15 | read comment4 16 | read param4 17 | read comment5 18 | read param5 19 | read comment6 20 | read param6 21 | read comment7 22 | read param7 23 | read comment8 24 | read param8 25 | read comment9 26 | read param9 27 | read comment10 28 | read param10 29 | read comment11 30 | read param11 31 | read comment12 32 | read param12 33 | read comment13 34 | read param13 35 | } < $Fileinf 36 | # 37 | if [ -f ./input/parap.par.temp ];then 38 | rm ./input/parap.par.temp 39 | fi 40 | # 41 | echo $comment1 >> ./input/parap.par.temp 42 | echo $param1 >> ./input/parap.par.temp 43 | echo $comment2 >> ./input/parap.par.temp 44 | echo $param2 >> ./input/parap.par.temp 45 | echo $comment3 >> ./input/parap.par.temp 46 | echo 0 >> ./input/parap.par.temp 47 | echo $comment4 >> ./input/parap.par.temp 48 | echo $param4 >> ./input/parap.par.temp 49 | echo $comment5 >> ./input/parap.par.temp 50 | echo $param5 >> ./input/parap.par.temp 51 | echo $comment6 >> ./input/parap.par.temp 52 | echo $param6 >> ./input/parap.par.temp 53 | echo $comment7 >> ./input/parap.par.temp 54 | echo $param7 >> ./input/parap.par.temp 55 | echo $comment8 >> ./input/parap.par.temp 56 | echo $param8 >> ./input/parap.par.temp 57 | echo $comment9 >> ./input/parap.par.temp 58 | echo $param9 >> ./input/parap.par.temp 59 | echo $comment10 >> ./input/parap.par.temp 60 | echo $param10 >> ./input/parap.par.temp 61 | echo $comment11 >> ./input/parap.par.temp 62 | echo $param11 >> ./input/parap.par.temp 63 | echo $comment12 >> ./input/parap.par.temp 64 | echo $param12 >> ./input/parap.par.temp 65 | echo $comment13 >> ./input/parap.par.temp 66 | echo 1 >> ./input/parap.par.temp 67 | # 68 | cp -v ./input/parap.par.temp ./input/param.par 69 | # 70 | else 71 | cp -v ./input/param.par.stb ./input/param.par 72 | fi 73 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/gnuwork/dvcoastlinetailer: -------------------------------------------------------------------------------- 1 | plot 'fort.67' index 0 using 1:2 with filledcurves ls 2 t '' \\ 2 | ,'fort.67' index 1 using 1:2 with filledcurves ls 1 title '' \\ 3 | ,'fort.67' index 2 using 1:2 with filledcurves ls 1 title '' \\ 4 | ,'fort.67' index 3 using 1:2 with filledcurves ls 2 title '' \\ 5 | ,'fort.67' index 4 using 1:2 with filledcurves ls 2 title '' \\ 6 | ,'fort.67' index 5 using 1:2 with filledcurves ls 2 title '' \\ 7 | ,'fort.67' index 6 using 1:2 with filledcurves ls 2 title '' \\ 8 | ,'fort.67' index 7 using 1:2 with filledcurves ls 1 title '' \\ 9 | ,'fort.67' index 8 using 1:2 with filledcurves ls 2 title '' \\ 10 | ,'fort.67' index 9 using 1:2 with filledcurves ls 2 title '' \\ 11 | ,'fort.67' index 10 using 1:2 with filledcurves ls 2 title '' \\ 12 | ,'fort.67' index 11 using 1:2 with filledcurves ls 2 title '' \\ 13 | ,'fort.67' index 12 using 1:2 with filledcurves ls 2 title '' \\ 14 | ,'fort.67' index 13 using 1:2 with filledcurves ls 2 title '' \\ 15 | ,'fort.67' index 14 using 1:2 with filledcurves ls 1 title '' \\ 16 | ,'fort.67' index 15 using 1:2 with filledcurves ls 2 title '' \\ 17 | ,'fort.67' index 16 using 1:2 with filledcurves ls 2 title '' \\ 18 | ,'fort.67' index 17 using 1:2 with filledcurves ls 2 title '' \\ 19 | ,'fort.67' index 18 using 1:2 with filledcurves ls 2 title '' \\ 20 | ,'fort.67' index 19 using 1:2 with filledcurves ls 2 title '' \\ 21 | ,'fort.67' index 20 using 1:2 with filledcurves ls 2 title '' \\ 22 | ,'fort.67' index 21 using 1:2 with filledcurves ls 2 title '' \\ 23 | ,'fort.67' index 22 using 1:2 with filledcurves ls 2 title '' \\ 24 | ,'fort.67' index 23 using 1:2 with filledcurves ls 2 title '' \\ 25 | ,'fort.67' index 24 using 1:2 with filledcurves ls 2 title '' \\ 26 | ,'fort.67' index 25 using 1:2 with filledcurves ls 2 title '' \\ 27 | ,'fort.67' index 26 using 1:2 with filledcurves ls 2 title '' \\ 28 | ,'fort.67' index 27 using 1:2 with filledcurves ls 2 title '' \\ 29 | ,'fort.67' index 28 using 1:2 with filledcurves ls 2 title '' 30 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divatest0: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | infolog 'Sanity check:' 6 | infolog 'Control the value of the field at (0,0)' 7 | infolog 'Should be 0.5' 8 | 9 | divaclean 10 | 11 | ##echo ${inputdir} 12 | divaecho "//////////////////////////////////////////////////" 13 | divaecho "Running a simple test" 14 | divaecho "//////////////////////////////////////////////////" 15 | divaecho ' ' 16 | 17 | divaecho '1. creating data file' 18 | divaecho ' ' 19 | 20 | echo '0 0 1' > ${datafile} 21 | 22 | divaecho '2. creating contour file' 23 | divaecho ' ' 24 | 25 | echo 1 > ${contfile} 26 | echo 4 >> ${contfile} 27 | echo -10 -10 >> ${contfile} 28 | echo 10 -10 >> ${contfile} 29 | echo 10 10 >> ${contfile} 30 | echo -10 10 >> ${contfile} 31 | 32 | 33 | divaecho '3. creating parameter file' 34 | divaecho ' ' 35 | 36 | echo '# Correlation Length lc' > ${paramfile} 37 | echo '1.0' >> ${paramfile} 38 | echo '# icoordchange' >> ${paramfile} 39 | echo '0' >> ${paramfile} 40 | echo '# ispec' >> ${paramfile} 41 | echo '11' >> ${paramfile} 42 | echo '# ireg' >> ${paramfile} 43 | echo '0' >> ${paramfile} 44 | echo '# xori' >> ${paramfile} 45 | echo '-10' >> ${paramfile} 46 | echo '# yori' >> ${paramfile} 47 | echo '-10' >> ${paramfile} 48 | echo '# dx' >> ${paramfile} 49 | echo '0.1' >> ${paramfile} 50 | echo '# dy' >> ${paramfile} 51 | echo '0.1' >> ${paramfile} 52 | echo '# nx' >> ${paramfile} 53 | echo '201' >> ${paramfile} 54 | echo '#ny' >> ${paramfile} 55 | echo '201' >> ${paramfile} 56 | echo '# valex' >> ${paramfile} 57 | echo '-99' >> ${paramfile} 58 | echo '# snr' >> ${paramfile} 59 | echo '1.0' >> ${paramfile} 60 | echo '# varbak' >> ${paramfile} 61 | echo '1.0' >> ${paramfile} 62 | 63 | divaecho '4. creating coordinate list file' 64 | divaecho ' ' 65 | 66 | echo 0.0 0.0 > ${valatxyfile} 67 | 68 | divamesh 69 | 70 | divacalc 71 | 72 | field0=$(awk '{print $3}' output/valatxyascii.anl) 73 | 74 | divaecho ' ' 75 | infolog 'Check the results in' 76 | infolog './ouput/ghertonetcdf/results.nc (netcdf)' 77 | infolog ' ' 78 | infolog 'Field value at origin = ' ${field0} 79 | divaecho ' ' 80 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvdetreref: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ' ' 3 | echo ============================================================= 4 | echo Preparing reference fields, here semi-normed with increased L 5 | echo ============================================================= 6 | echo ============================================================= 7 | echo Mesh with original L 8 | echo ============================================================= 9 | divamesh 10 | cp ./input/param.par ./input/param.par.ori 11 | Filepar=./input/param.par 12 | { 13 | read linecomment 14 | read lc 15 | read linecomment 16 | read icoordchange 17 | read linecomment 18 | read ispec 19 | read linecomment 20 | read ireg 21 | read linecomment 22 | read xori 23 | read linecomment 24 | read yori 25 | read linecomment 26 | read dx 27 | read linecomment 28 | read dy 29 | read linecomment 30 | read nx 31 | read linecomment 32 | read ny 33 | read linecomment 34 | read valex 35 | read linecomment 36 | read snr 37 | read linecomment 38 | read varbak 39 | } < $Filepar 40 | cd input 41 | head -1 param.par.ori > param.par 42 | ##echo $lc 5 | ../../bin/multiply.a >> param.par 43 | echo $(echo $lc | awk '{print ($1*5.0)}') >> param.par 44 | 45 | 46 | head -7 param.par.ori | tail -5 >> param.par 47 | echo 3 >> param.par 48 | head -23 param.par.ori | tail -15 >> param.par 49 | 50 | ##echo $snr 0.1 | ../../bin/multiply.a >> param.par 51 | echo $(echo $snr | awk '{print ($1*0.1)}') >> param.par 52 | 53 | echo varba >> param.par 54 | echo 0 >> param.par 55 | cd .. 56 | #divacalc 57 | ./divadetrend $1 $2 58 | # echo saving reference fields 59 | mv ./input/param.par.ori ./input/param.par 60 | cd divawork 61 | echo Output of results for user 62 | echo ' ' 63 | cp -v fort.84 ../output/fieldgher.anl.ref 64 | if [ -f fort.82 ] 65 | then 66 | cp -v fort.82 ../output/valatxyascii.anl.ref 67 | fi 68 | cp -v fort.83 ../output/fieldascii.anl.ref 69 | cp -v fort.71 ../output/fieldatdatapoint.anl.ref 70 | cd .. 71 | echo ' ' 72 | echo ============================================================== 73 | echo Finished preparing reference field 74 | echo ============================================================== 75 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/gebprep.F: -------------------------------------------------------------------------------- 1 | ************************************************************************ 2 | PROGRAM GEBCOPREP 3 | ************************************************************************ 4 | ! 5 | IMPLICIT NONE 6 | ! 7 | REAL*4 :: lon,lat,val 8 | REAL*4 :: lowlon, uplon, lowlat, uplat 9 | ! 10 | CHARACTER (len=99) :: FILEOUT,datafile 11 | CHARACTER (len=255) :: file_name 12 | CHARACTER (len=99) :: topofile 13 | CHARACTER (len=99), DIMENSION(2) :: var_name 14 | LOGICAL :: exist 15 | ! 16 | !----------------------------------------------------------------------- 17 | ! 18 | WRITE(datafile, 19 | &'("../input/",a)')'topo.gebco' 20 | 21 | WRITE(FILEOUT, 22 | &'("../input/",a)')'modif_topo.gebco' 23 | ! 24 | INQUIRE(FILE='fort.44',EXIST=exist) 25 | if(exist) then 26 | 27 | OPEN(44, FILE='fort.44') 28 | READ(44,*) lowlon, uplon, lowlat, uplat 29 | ! 30 | OPEN(10, FILE=TRIM(datafile), STATUS='OLD') 31 | OPEN(12, FILE=TRIM(FILEOUT)) 32 | OPEN(120, FILE='../output/tmpprt') 33 | 2 read(10,*,end=999) lon,lat,val 34 | IF(lon .gt. 180.) THEN 35 | !! write(*,*) 'changing lon value',lon,'==> ',lon-360. 36 | lon = lon - 360. 37 | ENDIF 38 | IF(lon .le. uplon .AND. lon .ge. lowlon) then 39 | IF(lat .le. uplat .AND. lat .ge. lowlat) then 40 | if(val .gt. 0.) val = -1.*val 41 | ENDIF 42 | ENDIF 43 | write(12,*) lon,lat,val 44 | goto 2 45 | 46 | else 47 | 48 | OPEN(10, FILE=TRIM(datafile), STATUS='OLD') 49 | OPEN(12, FILE=TRIM(FILEOUT)) 50 | OPEN(120, FILE='../output/tmpprt') 51 | 1 read(10,*,end=999) lon,lat,val 52 | IF(lon .gt. 180.) THEN 53 | lon = lon - 360. 54 | ENDIF 55 | write(12,*) lon,lat,val 56 | goto 1 57 | 58 | endif 59 | 60 | 999 continue 61 | CLOSE(10) 62 | CLOSE(12) 63 | STOP 64 | ! 65 | !-----Done-------------------------------------------------------------- 66 | ! 67 | END 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/testdivafit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | source divalogging 5 | 6 | inputdir=$(pwd)'/input/' 7 | contfile=${inputdir}'coast.cont' 8 | datafile=${inputdir}'data.dat' 9 | paramfile=${inputdir}'param.par' 10 | 11 | infoline -- 12 | infolog 'Testing divafit without data weight' 13 | infoline -- 14 | 15 | Nseed=226342.444 16 | awk -v Ndata=1000 -v Nseed=${Nseed} 'BEGIN {srand(Nseed); for (i = 1; i <= Ndata; i++) 17 | {x=rand();y=rand();print x,y,3*x*x-2*y-1} }' > ${datafile} 18 | 19 | echo '# Correlation Length lc' > ${paramfile} 20 | echo '0.2' >> ${paramfile} 21 | echo '# icoordchange' >> ${paramfile} 22 | echo '0' >> ${paramfile} 23 | echo '# ispec' >> ${paramfile} 24 | echo '0' >> ${paramfile} 25 | echo '# ireg' >> ${paramfile} 26 | echo '0' >> ${paramfile} 27 | echo '# xori' >> ${paramfile} 28 | echo '0' >> ${paramfile} 29 | echo '# yori' >> ${paramfile} 30 | echo '0' >> ${paramfile} 31 | echo '# dx' >> ${paramfile} 32 | echo '0.02' >> ${paramfile} 33 | echo '# dy' >> ${paramfile} 34 | echo '0.02' >> ${paramfile} 35 | echo '# nx' >> ${paramfile} 36 | echo '51' >> ${paramfile} 37 | echo '#ny' >> ${paramfile} 38 | echo '51' >> ${paramfile} 39 | echo '# valex' >> ${paramfile} 40 | echo '-99' >> ${paramfile} 41 | echo '# snr' >> ${paramfile} 42 | echo '1.0' >> ${paramfile} 43 | echo '# varbak' >> ${paramfile} 44 | echo '1.0' >> ${paramfile} 45 | 46 | ./divafit 47 | 48 | divaecho " " 49 | echo 'Estimated correlation length L: '$(awk 'FNR == 2 { print; exit }' ./output/paramfit.dat) 50 | divaecho 'Expected value of L: 0.197846353' 51 | 52 | divaecho -------------------------------------------------- 53 | divaecho 'Testing divafit with random data weight' 54 | divaecho -------------------------------------------------- 55 | divaecho ' ' 56 | 57 | Nseed=226342.444 58 | awk -v Ndata=1000 -v Nseed=${Nseed} 'BEGIN {srand(Nseed); for (i = 1; i <= Ndata; i++) 59 | {x=rand();y=rand();w=rand();print x,y,3*x*x-2*y-1,w} }' > ${datafile} 60 | 61 | ./divafit 62 | 63 | divaecho " " 64 | divaecho 'Estimated correlation length L: '$(awk 'FNR == 2 { print; exit }' ./output/paramfit.dat) 65 | divaecho 'Expected value of L: 0.179912895' 66 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/bcondi.f: -------------------------------------------------------------------------------- 1 | C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | C 3 | C SUBROUTINE LIST: 4 | C - BCONDI (MODULE) 5 | C - RDCOND (READ THE BOUNDARY CONDITIONS) 6 | C 7 | C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 9 | C C 10 | C BCONDI MODULE C 11 | C Dirichlet boundary conditions to be fixed C 12 | C C 13 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 14 | subroutine bcondi(ipr) 15 | include'divapre.h' 16 | #include "divainc.h" 17 | C 18 | C READ THE BOUNDARY CONDITIONS TO BE IMPLEMENTED 19 | C 20 | read(10,*)ncond 21 | if(ipr.gt.0) write(6,*) ' Number of Boundary Conditions =',ncond 22 | info=1 23 | if(ityp.eq.2.or.ityp.eq.3) info=2 24 | C 25 | C ALLOCATION OF STORAGE TABLES: 26 | C ==> TCNDI(I) : VALUE OF BOUNDARY CONDITION I 27 | C ==> KCNDI(I,*) : NODE FOR BOUNDARY CONDITION 28 | C (IF ITYP.EQ.2 OR 3, ALSO CONNECTOR AT NODE !!!) 29 | C 30 | call allody(ncond,1,'tcndi',ltcndi,ipr) 31 | call allody(ncond*info,0,'kcndi',lkcndi,ipr) 32 | call rdcond(l(lkcndi),s(ltcndi),ipr) 33 | return 34 | end 35 | 36 | 37 | subroutine rdcond(kcndi,tcndi,ipr) 38 | C 39 | C I/O BOUNDARY CONDITIONS TO BE FIXED (ONLY DIRICHLET TYPE) 40 | C 41 | include'divapre.h' 42 | #include "divainc.h" 43 | dimension tcndi(ncond),kcndi(ncond,info) 44 | C 45 | C INPUT OF B.C. DESCRIPTION 46 | C 47 | do 10 i=1,ncond 48 | read(30,*) tcndi(i),(kcndi(i,j),j=1,info) 49 | 10 continue 50 | C 51 | C OUTPUT OF B.C. DESCRIPTION 52 | C 53 | if(ipr.ge.3) then 54 | write(6,*)' List of B.C. value, nodes and d.o.f. ' 55 | write(6,*)' --------------------------------------------------' 56 | do 100 i=1,ncond 57 | write(6,*) tcndi(i),(kcndi(i,j),j=1,info) 58 | 100 continue 59 | endif 60 | return 61 | end 62 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/N2brunt.F: -------------------------------------------------------------------------------- 1 | subroutine N2brunt 2 | & (valex,imax,jmax,maxt,Z,ict,alpha,beta,T,S,N2,rmsp,rmsn) 3 | implicit none 4 | ! 5 | ! in : z, T, S fields 6 | ! out: N2 = db/dz field, where b is the buoyency 7 | ! rmsn = rms of all the negative N2 in the field 8 | ! rmsp = positive 9 | ! 10 | integer :: imax,jmax,maxt 11 | real, dimension(imax,jmax,maxt), intent(in) :: S,T 12 | real, dimension(imax,jmax) :: alpha,beta 13 | integer ,dimension(imax,jmax,maxt), intent(in) :: ict 14 | real, dimension(imax,jmax,maxt-1), intent(out) :: N2 15 | real, dimension(maxt), intent(in) :: Z 16 | real, intent(out) :: rmsp,rmsn 17 | 18 | real, dimension(imax,jmax,maxt) :: B 19 | real :: DZ,G,FACA,FACB 20 | ! 21 | real :: valex 22 | integer :: i,j,k, nv,np,nn,istat 23 | 24 | ! inplace bouyancy in place 25 | ! 26 | G = 9.81 27 | do j=1,jmax 28 | do i=1,imax 29 | IF (ict(i,j,1) == 1) then 30 | B(i,j,1) = G*alpha(i,j)*(T(i,j,2)-T(i,j,1)) 31 | B(i,j,2) = G*beta(i,j) *(S(i,j,2)-S(i,j,1)) 32 | else 33 | B(i,j,1:2) = valex 34 | endif 35 | enddo 36 | enddo 37 | ! 38 | nn=0 39 | np=0 40 | nv=0 41 | rmsn=0. 42 | rmsp=0. 43 | 44 | k=1 45 | do j=1,jmax 46 | do i=1,imax 47 | if (ict(i,j,k) == 1 ) then 48 | N2(i,j,k)=(B(i,j,1)-B(i,j,2))/(Z(k+1)-Z(k)) 49 | if (N2(i,j,k).lt.0.) then 50 | rmsn=rmsn+(N2(i,j,k)*N2(i,j,k)) 51 | nn=nn+1 52 | else 53 | rmsp=rmsp+(N2(i,j,k)*N2(i,j,k)) 54 | np=np+1 55 | end if 56 | else 57 | N2(i,j,k)=valex 58 | nv=nv+1 59 | end if 60 | end do 61 | end do 62 | !========= 63 | 64 | if (nn.gt.0) then 65 | rmsn=sqrt(rmsn/nn) 66 | else 67 | rmsn=0.0 68 | end if 69 | if (np.gt.0) then 70 | rmsp=sqrt(rmsp/np) 71 | else 72 | rmsp=0.0 73 | end if 74 | ! 75 | !xx write(*,*)' rmsp = ',rmsp 76 | !xx write(*,*)' rmsn = ',rmsn 77 | 78 | end subroutine 79 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Util/subsampling.f: -------------------------------------------------------------------------------- 1 | parameter (nmax=30000000) 2 | integer*2 ic(nmax) 3 | 4 | 5 | 6 | read(5,*) nsample,ndata,seed,ncol 7 | 8 | write(6,*) 'Subsampling',nsample,ndata,seed,ncol 9 | 10 | if(ndata.gt.nmax) then 11 | write(6,*) "increase nmax in subsampling.f" 12 | ndata=nmax 13 | endif 14 | do i=1,ndata 15 | ic(i)=0 16 | enddo 17 | i=0 18 | ii=nint(seed+ndata) 19 | call mysrand(ii) 20 | 99 continue 21 | if(i.ge.nsample) goto 100 22 | 23 | j=nint((ndata-1)*randf())+1 24 | if (ic(j).eq.1) goto 99 25 | ic(j)=1 26 | i=i+1 27 | goto 99 28 | 100 continue 29 | i=0 30 | 101 continue 31 | if (ncol.eq.3) then 32 | read(20,*,end=200,err=200) x,y,val 33 | else 34 | read(20,*,end=200,err=200) x,y,val,w 35 | endif 36 | i=i+1 37 | c write(6,*) 'ii',i,x,y,ndata,ic(i) 38 | if(i.gt.ndata) then 39 | i=ndata 40 | write(6,*) 'Problem with data file (last line?)' 41 | goto 200 42 | endif 43 | C reduced data 44 | if(ic(i).eq.0) then 45 | if (ncol.eq.3) then 46 | write(44,*) x,y,val 47 | else 48 | write(44,76) x,y,val,w 49 | endif 50 | C reference data 51 | else 52 | if (ncol.eq.3) then 53 | write(45,*) x,y,val 54 | else 55 | write(45,76) x,y,val,w 56 | endif 57 | 58 | endif 59 | goto 101 60 | 200 continue 61 | 76 FORMAT(4(E19.7)) 62 | stop 63 | end 64 | 65 | FUNCTION RANDF() 66 | 67 | integer iseed,ia,ic,iq,ir 68 | COMMON /CSEED/ ISEED 69 | DATA IA/16807/,IC/2147483647/,IQ/127773/,IR/2836/ 70 | 71 | IH = ISEED/IQ 72 | IL = MOD(ISEED,IQ) 73 | IT = IA*IL-IR*IH 74 | IF(IT.GT.0) THEN 75 | ISEED = IT 76 | ELSE 77 | ISEED = IC+IT 78 | END IF 79 | RANDF = ISEED/FLOAT(IC) 80 | RETURN 81 | END 82 | subroutine mysrand(i) 83 | COMMON /CSEED/ ISEED 84 | iseed=i 85 | return 86 | end -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/potmp.F: -------------------------------------------------------------------------------- 1 | SUBROUTINE POTMP(PRESS,TEMP,S,RP,POTEMP) 2 | C 3 | C TITLE: 4 | C ***** 5 | C 6 | C POTMP -- CALCULATE POTENTIAL TEMPERATURE FOR AN ARBITRARY 7 | C REFERENCE PRESSURE 8 | C 9 | C PURPOSE: 10 | C ******* 11 | C 12 | C TO CALCULATE POTENTIAL TEMPERATURE 13 | C 14 | C REF: N.P. FOFONOFF 15 | C DEEP SEA RESEARCH 16 | C IN PRESS NOV 1976 17 | C 18 | C PARAMETERS: 19 | C ********** 20 | C 21 | C PRESS -> PRESSURE IN DECIBARS 22 | C TEMP -> TEMPERATURE IN CELSIUS DEGREES 23 | C S -> SALINITY PSS 78 24 | C RP -> REFERENCE PRESSURE IN DECIBARS 25 | C (0.0 FOR THE QUANTITY THETA) 26 | C POTEMP <- POTENTIAL TEMPERATURE (DEG C) 27 | C 28 | REAL PRESS,TEMP,S,RP,POTEMP 29 | C 30 | C VARIABLES: 31 | C ********* 32 | C 33 | INTEGER I,J,N 34 | REAL*4 DP,P,Q,R1,R2,R3,R4,R5,S1,T,X 35 | C 36 | C CODE: 37 | C **** 38 | C 39 | S1 = S-35.0 40 | P = PRESS 41 | T = TEMP 42 | C 43 | DP = RP - P 44 | N = IFIX(ABS(DP)/1000.) + 1 45 | DP = DP/FLOAT(N) 46 | C 47 | DO 10 I=1,N 48 | DO 20 J=1,4 49 | C 50 | R1 = ((-2.1687E-16*T+1.8676E-14)*T-4.6206E-13)*P 51 | R2 = (2.7759E-12*T-1.1351E-10)*S1 52 | R3 = ((-5.4481E-14*T+8.733E-12)*T-6.7795E-10)*T 53 | R4 = (R1+(R2+R3+1.8741E-8))*P+(-4.2393E-8*T+1.8932E-6)*S1 54 | R5 = R4+((6.6228E-10*T-6.836E-8)*T+8.5258E-6)*T+3.5803E-5 55 | C 56 | X = DP*R5 57 | C 58 | GO TO (100,200,300,400),J 59 | C 60 | 100 CONTINUE 61 | T = T+.5*X 62 | Q = X 63 | P = P + .5*DP 64 | GO TO 20 65 | C 66 | 200 CONTINUE 67 | T = T + .29298322*(X-Q) 68 | Q = .58578644*X + .121320344*Q 69 | GO TO 20 70 | C 71 | 300 CONTINUE 72 | T = T + 1.707106781*(X-Q) 73 | Q = 3.414213562*X - 4.121320344*Q 74 | P = P + .5*DP 75 | GO TO 20 76 | C 77 | 400 CONTINUE 78 | T = T + (X-2.0*Q)/6.0 79 | 20 CONTINUE 80 | 10 CONTINUE 81 | C 82 | POTEMP = T 83 | RETURN 84 | C 85 | C END POTMP 86 | C 87 | END 88 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divatest2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | if [ "$#" == "1" ] 6 | then 7 | Ndata=$1 8 | else 9 | Ndata=100 10 | fi 11 | 12 | ##echo ${inputdir} 13 | infolog -- 14 | infolog 'Running a test with divafit' 15 | infolog -- 16 | divaecho ' ' 17 | 18 | divaecho '1. creating data file' 19 | divaecho ' with points at random coordinates' 20 | divaecho ' ' 21 | 22 | awk -v N=$Ndata 'BEGIN { for (i = 1; i <= N; i++) 23 | {x=rand();y=rand();print x,y,3*x-2*y-1} }' > ${datafile} 24 | 25 | divaecho '2. creating contour file' 26 | divaecho ' ' 27 | 28 | echo 2 > ${contfile} 29 | echo 4 >> ${contfile} 30 | echo 0 0 >> ${contfile} 31 | echo 1 0 >> ${contfile} 32 | echo 1 1 >> ${contfile} 33 | echo 0 1 >> ${contfile} 34 | echo 4 >> ${contfile} 35 | echo 0.4 0.2 >> ${contfile} 36 | echo 0.4 0.8 >> ${contfile} 37 | echo 0.6 0.8 >> ${contfile} 38 | echo 0.6 0.2 >> ${contfile} 39 | 40 | divaecho '3. creating parameter file' 41 | divaecho ' ' 42 | 43 | echo '# Correlation Length lc' > ${paramfile} 44 | echo '0.2' >> ${paramfile} 45 | echo '# icoordchange' >> ${paramfile} 46 | echo '0' >> ${paramfile} 47 | echo '# ispec' >> ${paramfile} 48 | echo '0' >> ${paramfile} 49 | echo '# ireg' >> ${paramfile} 50 | echo '0' >> ${paramfile} 51 | echo '# xori' >> ${paramfile} 52 | echo '0' >> ${paramfile} 53 | echo '# yori' >> ${paramfile} 54 | echo '0' >> ${paramfile} 55 | echo '# dx' >> ${paramfile} 56 | echo '0.02' >> ${paramfile} 57 | echo '# dy' >> ${paramfile} 58 | echo '0.02' >> ${paramfile} 59 | echo '# nx' >> ${paramfile} 60 | echo '51' >> ${paramfile} 61 | echo '#ny' >> ${paramfile} 62 | echo '51' >> ${paramfile} 63 | echo '# valex' >> ${paramfile} 64 | echo '-99' >> ${paramfile} 65 | echo '# snr' >> ${paramfile} 66 | echo '1.0' >> ${paramfile} 67 | echo '# varbak' >> ${paramfile} 68 | echo '1.0' >> ${paramfile} 69 | 70 | divamesh 71 | 72 | divaecho ' ' 73 | 74 | divacalc 75 | 76 | cp ./output/ghertonetcdf/results.nc ./output/ghertonetcdf/results_nofit.nc 77 | 78 | divafit -r 79 | 80 | divacalc 81 | 82 | cp ./output/ghertonetcdf/results.nc ./output/ghertonetcdf/results_fit.nc 83 | 84 | divaecho ' ' 85 | infolog 'Check the results in' 86 | infolog './ouput/ghertonetcdf/results_notfit.nc (before estimation of L)' 87 | infolog './ouput/ghertonetcdf/results_fit.nc (after estimation of L)' 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dbdb2diva: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo ////////////////////////////////////////////////// 3 | echo Generating topography 4 | echo ////////////////////////////////////////////////// 5 | echo ' ' 6 | echo Cleaning up old files 7 | echo ' ' 8 | rm -f ./divawork/fort.10 9 | rm -f ./divawork/fort.11 10 | rm -f ./divawork/fort.12 11 | rm -f ./divawork/fort.20 12 | echo Finished cleaning 13 | FILENAME=./input/topo.asc 14 | head -1 $FILENAME > bidon 15 | FNAME=bidon 16 | { 17 | read AA BB CC DD EE 18 | } < $FNAME 19 | echo $AA $BB $CC $DD $EE 20 | head -2 $FILENAME | tail -1 > bidon 21 | FNAME=bidon 22 | { 23 | read AAB BBB CCB DDB EEB 24 | } < $FNAME 25 | echo $AAB $BBB $CCB $DDB $EEB 26 | echo Making TopoInfo.dat 27 | echo ${AA#*:} > ./output/TopoInfo.dat 28 | echo ${CC#*:} >> ./output/TopoInfo.dat 29 | echo ${EE#*:} >> ./output/TopoInfo.dat 30 | echo ${EE#*:} >> ./output/TopoInfo.dat 31 | echo ${AAB#*:} >> ./output/TopoInfo.dat 32 | echo ${BBB#*:} >> ./output/TopoInfo.dat 33 | echo >> ./output/TopoInfo.dat 34 | cat ./output/TopoInfo.dat 35 | mv ./output/TopoInfo.dat ./divawork/fort.10 36 | cat ./input/topo.asc > ./divawork/fort.11 37 | cd ./divawork 38 | if [ -f ../output/diva.log ] ; then 39 | cp -f ../output/diva.log . 40 | fi 41 | ../../bin/dbdb2diva.a >> diva.log 42 | if [ $? -ne 0 ];then 43 | echo ' ' 44 | echo -------------------------------------------- 45 | echo A problem was encountered during execution ! 46 | echo dbdb2diva.a 47 | echo Check execution track 48 | echo -------------------------------------------- 49 | echo ' ' >> diva.log 50 | echo -------------------------------------------- >> diva.log 51 | echo A problem was encountered during execution ! >> diva.log 52 | echo dbdb2diva.a >> diva.log 53 | echo Check execution track >> diva.log 54 | echo -------------------------------------------- >> diva.log 55 | fi 56 | cp -f diva.log ../output/. 57 | cd .. 58 | mv ./divawork/fort.12 ./output/topo.grd 59 | mv ./divawork/fort.20 ./output/TopoInfo.dat 60 | rm ./divawork/fort.10 61 | rm ./divawork/fort.11 62 | echo ----------------------- 63 | echo Topography is generated 64 | echo ----------------------- 65 | if [ "$1" == "-r" ] 66 | then 67 | echo 'Moving topography files into ./input directory' 68 | cp -v ./output/topo.grd ./input 69 | cp -v ./output/TopoInfo.dat ./input 70 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/divarefe: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | infolog -- | tee -a $divalog 6 | infolog 'Creation of the reference field' | tee -a $divalog 7 | infolog -- | tee -a $divalog 8 | 9 | 10 | echo ' ' 11 | echo '=============================================================' 12 | echo 'Preparing reference fields, here semi-normed with increased L' 13 | echo '=============================================================' 14 | echo '=============================================================' 15 | echo 'Mesh with original L' 16 | echo '=============================================================' 17 | divamesh 18 | cp ./input/param.par ./input/param.par.ori 19 | Filepar=./input/param.par 20 | { 21 | read linecomment 22 | read lc 23 | read linecomment 24 | read icoordchange 25 | read linecomment 26 | read ispec 27 | read linecomment 28 | read ireg 29 | read linecomment 30 | read xori 31 | read linecomment 32 | read yori 33 | read linecomment 34 | read dx 35 | read linecomment 36 | read dy 37 | read linecomment 38 | read nx 39 | read linecomment 40 | read ny 41 | read linecomment 42 | read valex 43 | read linecomment 44 | read snr 45 | read linecomment 46 | read varbak 47 | } < $Filepar 48 | cd input 49 | head -1 param.par.ori > param.par 50 | 51 | ##echo $lc 5 | ../../bin/multiply.a >> param.par 52 | echo $(echo $lc | awk '{print ($1*5.0)}') >> param.par 53 | 54 | 55 | head -7 param.par.ori | tail -5 >> param.par 56 | echo 3 >> param.par 57 | head -23 param.par.ori | tail -15 >> param.par 58 | 59 | ##echo $snr 0.1 | ../../bin/multiply.a >> param.par 60 | echo $(echo $snr | awk '{print ($1*0.1)}') >> param.par 61 | 62 | echo varba >> param.par 63 | echo $varbak $snr | awk '{print 0.1*(1+$2)/(1+0.1*$2)*$1}' >> param.par 64 | cd .. 65 | divacalc 66 | # echo saving reference fields 67 | mv ./input/param.par.ori ./input/param.par 68 | cd divawork 69 | echo Output of results for user 70 | echo ' ' 71 | cp -v fort.84 ../output/fieldgher.anl.ref 72 | if [ -f fort.82 ] 73 | then 74 | cp -v fort.82 ../output/valatxyascii.anl.ref 75 | fi 76 | cp -v fort.83 ../output/fieldascii.anl.ref 77 | cp -v fort.71 ../output/fieldatdatapoint.anl.ref 78 | cd .. 79 | echo ' ' 80 | echo '==============================================================' 81 | echo 'Finished preparing reference field' 82 | echo '==============================================================' 83 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/brunt.F: -------------------------------------------------------------------------------- 1 | subroutine brunt 2 | & (valex,imax,jmax,maxt,Z,ict,alpha,beta,T,S,N2,rmsp,rmsn) 3 | implicit none 4 | ! 5 | ! in : z, T, S fields 6 | ! out: N2 = db/dz field, where b is the buoyency 7 | ! rmsn = rms of all the negative N2 in the field 8 | ! rmsp = positive 9 | ! 10 | integer :: imax,jmax,maxt 11 | real, dimension(imax,jmax,maxt), intent(in) :: S,T 12 | real, dimension(imax,jmax,maxt) :: alpha,beta 13 | integer ,dimension(imax,jmax,maxt), intent(in) :: ict 14 | real, dimension(imax,jmax,maxt-1), intent(out) :: N2 15 | real, dimension(maxt), intent(in) :: Z 16 | real, dimension(maxt), intent(out) :: rmsp,rmsn 17 | 18 | real, dimension(imax,jmax,maxt) :: B 19 | real :: DZ,G,FACA,FACB 20 | ! 21 | real :: valex 22 | integer :: i,j,k, nv,np,nn,istat 23 | 24 | ! inplace bouyancy in place 25 | ! 26 | G = 9.81 27 | 28 | DO k=1,maxt-1 29 | 30 | do j=1,jmax 31 | do i=1,imax 32 | IF (ict(i,j,k) == 1) then 33 | B(i,j,k) = G*alpha(i,j,k)*(T(i,j,k+1)-T(i,j,k)) 34 | B(i,j,k+1) = G*beta(i,j,k) *(S(i,j,k+1)-S(i,j,k)) 35 | else 36 | B(i,j,1:k+1) = valex 37 | endif 38 | enddo 39 | enddo 40 | ! 41 | nn=0 42 | np=0 43 | nv=0 44 | rmsn=0. 45 | rmsp=0. 46 | 47 | !! k=1 48 | 49 | do j=1,jmax 50 | do i=1,imax 51 | if (ict(i,j,k) == 1 ) then 52 | N2(i,j,k)=(B(i,j,k)-B(i,j,k+1))/(Z(k+1)-Z(k)) 53 | if (N2(i,j,k).lt.0.) then 54 | rmsn=rmsn+(N2(i,j,k)*N2(i,j,k)) 55 | nn=nn+1 56 | else 57 | rmsp=rmsp+(N2(i,j,k)*N2(i,j,k)) 58 | np=np+1 59 | end if 60 | else 61 | N2(i,j,k)=valex 62 | nv=nv+1 63 | end if 64 | end do 65 | end do 66 | ENDDO 67 | ! 68 | N2(:,:,maxt) = 0. 69 | if (nn.gt.0) then 70 | rmsn=sqrt(rmsn/nn) 71 | else 72 | rmsn=0.0 73 | end if 74 | ! 75 | if (np.gt.0) then 76 | rmsp=sqrt(rmsp/np) 77 | else 78 | rmsp=0.0 79 | end if 80 | ! 81 | write(*,*)' rmsp = ',np,rmsp 82 | write(*,*)' rmsn = ',nn,rmsn 83 | 84 | end subroutine 85 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divatestint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | source divalogging 5 | 6 | 7 | 8 | infolog -- 9 | infolog 'Testing domain integral computation' 10 | infolog -- 11 | 12 | inputdir=$(pwd)'/input/' 13 | contfile=${inputdir}'coast.cont' 14 | datafile=${inputdir}'data.dat' 15 | paramfile=${inputdir}'param.par' 16 | 17 | ./divaclean 18 | 19 | echo '0.3 0.3 1' > ${datafile} 20 | echo '0.55 0.9 -1' >> ${datafile} 21 | echo '0.85 0.1 0.2' >> ${datafile} 22 | 23 | echo 2 > ${contfile} 24 | echo 4 >> ${contfile} 25 | echo -0.001 -0.001 >> ${contfile} 26 | echo 1.001 -0.001 >> ${contfile} 27 | echo 1.001 1.001 >> ${contfile} 28 | echo -0.001 1.001 >> ${contfile} 29 | echo 4 >> ${contfile} 30 | echo 0.401 0.201 >> ${contfile} 31 | echo 0.401 0.801 >> ${contfile} 32 | echo 0.601 0.801 >> ${contfile} 33 | echo 0.601 0.201 >> ${contfile} 34 | 35 | 36 | echo '# Correlation Length lc' > ${paramfile} 37 | echo '0.2' >> ${paramfile} 38 | echo '# icoordchange' >> ${paramfile} 39 | echo '2' >> ${paramfile} 40 | echo '# ispec' >> ${paramfile} 41 | echo '101' >> ${paramfile} 42 | echo '# ireg' >> ${paramfile} 43 | echo '0' >> ${paramfile} 44 | echo '# xori' >> ${paramfile} 45 | echo '0' >> ${paramfile} 46 | echo '# yori' >> ${paramfile} 47 | echo '0' >> ${paramfile} 48 | echo '# dx' >> ${paramfile} 49 | echo '0.02' >> ${paramfile} 50 | echo '# dy' >> ${paramfile} 51 | echo '0.02' >> ${paramfile} 52 | echo '# nx' >> ${paramfile} 53 | echo '51' >> ${paramfile} 54 | echo '#ny' >> ${paramfile} 55 | echo '51' >> ${paramfile} 56 | echo '# valex' >> ${paramfile} 57 | echo '-99' >> ${paramfile} 58 | echo '# snr' >> ${paramfile} 59 | echo '1.0' >> ${paramfile} 60 | echo '# varbak' >> ${paramfile} 61 | echo '1.0' >> ${paramfile} 62 | 63 | ./divamesh 64 | 65 | ./divacalc 66 | 67 | divaecho "Computing integral over domain" 68 | 69 | ./divaintegral 70 | 71 | integralfile=./output/integral.dat 72 | { 73 | read integralvalues 74 | } < $integralfile 75 | 76 | # Split values (written in same line) 77 | integralvaluesplit=(${integralvalues// / }) 78 | 79 | infolog -- 80 | infolog " Obtained values (expected)" 81 | infolog "---------------------------------------------------" 82 | infolog "Integral value: " ${integralvaluesplit[0]} "(5.14786e+08)" 83 | infolog "Surface: " ${integralvaluesplit[1]} "(1.13761e+10)" 84 | infolog "Averaged value: " ${integralvaluesplit[2]} "(0.0452516)" 85 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dv3Ddatamix: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | ################ 3 | # 4 | bottm=$1 5 | surf=$2 6 | var=$3 7 | itrans=$4 8 | # 9 | if [ -d ./3DWORK ];then 10 | echo 'starting data layers merging' 11 | else 12 | mkdir -p ./3DWORK 13 | echo 'starting data layers merging' 14 | fi 15 | # Start layers combination 16 | ################################# 17 | # 18 | let nblay=$(($surf-$bottm)) 19 | if [ $nblay -gt 2 ]; then 20 | let ic=0 21 | else 22 | let ic=1 23 | fi 24 | # 25 | dep=$bottm 26 | rm -f ./3DWORK/fort.44 27 | while [ $dep -le $surf ] 28 | do 29 | let level=$((10000+$dep)) 30 | let depm=0 31 | let depp=0 32 | if [ $ic -eq "0" ]; then 33 | if [ $dep == $bottm ];then 34 | let depm=$(($dep+1)) 35 | let depp=$(($dep+2)) 36 | else 37 | if [ $dep == $surf ];then 38 | let depm=$(($dep-2)) 39 | let depp=$(($dep-1)) 40 | else 41 | let depm=$(($dep-1)) 42 | let depp=$(($dep+1)) 43 | fi 44 | fi 45 | fi 46 | if [ $ic -eq "1" ]; then 47 | if [ $dep == $bottm ];then 48 | let depp=$(($dep+1)) 49 | else 50 | if [ $dep == $surf ];then 51 | let depp=$(($dep-1)) 52 | fi 53 | fi 54 | fi 55 | # 56 | if [ "$depm" -ne "0" ]; then 57 | let levelm=$((10000+$depm)) 58 | fi 59 | if [ "$depp" -ne "0" ]; then 60 | let levelp=$((10000+$depp)) 61 | fi 62 | #=============================================================== 63 | # 64 | # 65 | cd ./input/divadata_ORI 66 | 67 | file=$var.$level 68 | nbcl=$(head -n 1 $file | wc -w) 69 | nbln=$(cat $file |wc -l) 70 | 71 | filep=$var.$levelp 72 | nbclp=$(head -n 1 $filep | wc -w) 73 | nblnp=$(cat $filep |wc -l) 74 | 75 | if [ $depp -ne "0" ]; then 76 | filem=$var.$levelm 77 | nbclm=$(head -n 1 $filem | wc -w) 78 | nblnm=$(cat $filem |wc -l) 79 | else 80 | nbclm=$nbclp 81 | nblnm=$nblnp 82 | fi 83 | 84 | echo $var > ../../3DWORK/fort.44 85 | echo $itrans >> ../../3DWORK/fort.44 86 | echo $bottm >> ../../3DWORK/fort.44 87 | echo $surf >> ../../3DWORK/fort.44 88 | echo $nbln' '$nblnp' '$nblnm >> ../../3DWORK/fort.44 89 | echo $nbcl' '$nbclp' '$nbclm >> ../../3DWORK/fort.44 90 | echo $dep >> ../../3DWORK/fort.44 91 | 92 | cd ../../3DWORK/ 93 | ../../bin/datamix.a 94 | cd ../ 95 | # 96 | dep=`expr $dep + 1` 97 | done 98 | echo 'finished transforming data' 99 | # 100 | # End transformations 101 | ################################# 102 | # 103 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/allody.f: -------------------------------------------------------------------------------- 1 | C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | C 3 | C SUBROUTINE LIST: 4 | C - ALLODY (dynamical allocation of storage area in S or L vector) 5 | 6 | 7 | SUBROUTINE ALLODY(NCOMP,IR,TAB,IDEB,IPR) 8 | C ==================================== 9 | include'divapre.h' 10 | #include "divainc.h" 11 | CHARACTER*(*) TAB 12 | DATA ZERO/0.0D0/ 13 | IF(IR.EQ.0) GO TO 20 14 | C 15 | C STORAGE IN S VECTOR 16 | C 17 | IRE1=IRE+NCOMP 18 | C 19 | C LENGTH TEST 20 | C 21 | IF(IRE1.LE.NREA) GO TO 10 22 | C#ifdef DIVADYNAMIC 23 | write(6,*) 'Dynamic reallocation' 24 | write(6,*) 'Might cause crash if not enough memory left' 25 | write(6,*) 'Momentarely doubles memory needed' 26 | 27 | C allocate SN(IRE) 28 | C copy S into SN 29 | C deallocate S 30 | C allocate S(IRE1) 31 | C copy SN into S 32 | C NREA=IRE1 33 | C goto 10 34 | C#endif 35 | WRITE(6,400) TAB,IRE1,NREA 36 | 400 FORMAT(/' ** ERROR - ALLODY - STORAGE OF ',A5,/,' REQUIRED SPACE' 37 | * ,I10,/' AVAILABLE SPACE : ',I10) 38 | STOP 'SEVERE ERROR' 39 | 10 IDEB=IRE+1 40 | IRE=IRE1 41 | IF(IRE.GT.IREMAX) IREMAX=IRE 42 | if(IPR.EQ.99) RETURN 43 | IF(IPR.GE.2) WRITE(6,401) TAB,IDEB,IRE 44 | 401 FORMAT(2X,'ARRAY ',A5,' STORED IN S(',I8,') TO S(',I8,')') 45 | C 46 | C INITIALISATION TO ZERO OF THE NEWLY CREATED TABLE 47 | C unless call with ipr=99 48 | C 49 | #ifdef ALLODYZERO 50 | DO 11 I=IDEB,IRE 51 | 11 S(I)=ZERO 52 | #endif 53 | RETURN 54 | 20 CONTINUE 55 | C 56 | C STORAGE IN L VECTOR 57 | C 58 | IEN1=IEN+NCOMP 59 | C 60 | C LENGTH TEST 61 | C 62 | IF(IEN1.LE.NENT) GO TO 30 63 | C#ifdef DIVADYNAMIC 64 | 65 | C allocate LN(IEN) 66 | C copy L into LN 67 | C deallocate L 68 | C allocate L(IEN1) 69 | C copy SN into S 70 | 71 | C NENT=IEN1 72 | C goto 30 73 | C#endif 74 | 75 | WRITE(6,400) TAB,IEN1,NENT 76 | STOP 77 | 30 IDEB=IEN+1 78 | IEN=IEN1 79 | IF(IEN.GT.IENMAX) IENMAX=IEN 80 | if(IPR.EQ.99) RETURN 81 | IF(IPR.GE.2) WRITE(6,402) TAB,IDEB,IEN 82 | 402 FORMAT(2X,'ARRAY ',A5,' STORED IN L(',I8,') TO L(',I8,')') 83 | C 84 | C INITIALISATION TO ZERO OF THE NEWLY CREATED TABLE 85 | C 86 | #ifdef ALLODYZERO 87 | DO 31 I=IDEB,IEN 88 | 31 L(I)=0 89 | #endif 90 | RETURN 91 | END 92 | 93 | 94 | -------------------------------------------------------------------------------- /JRA4/Climatology/divaweighting: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #set -x # to debug 4 | export LC_ALL=C 5 | 6 | #----------------------------------------------------------------------------------------------- 7 | # Sylvain Watelet - 10/03/2015 8 | # Weighting of extracted data according to delta_lon, delta_lat, delta_time via the product R.x 9 | # where x()=1 10 | #----------------------------------------------------------------------------------------------- 11 | 12 | saveifs=$IFS 13 | IFS=$'\n' 14 | 15 | #------------------------------------------------ 16 | # Reading input param 17 | #------------------------------------------------ 18 | 19 | filename="./input/param.par" 20 | if [ -f $filename ] 21 | then 22 | { 23 | read 24 | read CL 25 | read 26 | read rcoordchange 27 | } < $filename 28 | else 29 | echo "divaweighting : ERROR : NO param.par in input/ !!! The weighting is NOT performed." 30 | sleep 10 31 | exit 32 | fi 33 | 34 | filename="./input/radiusweighting.par" 35 | if [ -f $filename ] 36 | then 37 | { 38 | read 39 | read LS1 #=LS2 40 | read 41 | read LS3 42 | } < $filename 43 | else 44 | echo "WARNING : no radiusweighting.par file in ./input !!! Weighting will use default values for charateristic length and time." 45 | sleep 0.1 46 | LS1=$(echo "CL/10." | bc -l) 47 | LS3=7 # assumed cruise period 48 | fi 49 | 50 | echo "Characteristic length is" $LS1 "(same units as data) and characteristic time is" $LS3 "days" 51 | 52 | #------------------------------------------------ 53 | # Computation of weights 54 | #------------------------------------------------ 55 | 56 | for var in `cat varlist` 57 | do 58 | for year in `cat yearlist` 59 | do 60 | for month in `cat monthlist` 61 | do 62 | lev="0" 63 | for layer in `cat input/contour.depth` 64 | do 65 | let lev=$(($lev+1)) 66 | let lnum=$((10000+$lev)) 67 | datafile="./input/divadata/"${var}".${year}.${month}.${lnum}" 68 | 69 | echo "1) Backup and reading" $datafile ... 70 | cp $datafile ${datafile}"_beforeweighting" 71 | cp $datafile ./Datawork/fort.20 72 | 73 | echo $LS1 $rcoordchange $LS3 > ./Datawork/fort.10 74 | 75 | cd ./Datawork 76 | rm -f fort.22 77 | ../../../DIVA3D/bin/Rtimesx_weighting.a 78 | echo "2) Writing new weights..." 79 | if [ -f fort.22 ] 80 | then 81 | cp fort.22 ../$datafile 82 | fi 83 | echo "3) Done." 84 | cd .. 85 | done 86 | done 87 | 88 | done 89 | done 90 | IFS=$saveifs 91 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Calc/ureadc.f: -------------------------------------------------------------------------------- 1 | Subroutine UREADC(iu,c8,c4,valexr,iprecr,imaxr,jmaxr,kmaxr,nbmotr) 2 | c ====== 3 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 4 | c Reads the field C(I,J,K) from fortran unit iu 5 | c returns the field in the array c4 if the returned iprecr=4 6 | c returns the field in the array c8 if the returned iprecr=8 7 | c returns the values if imaxr,jmaxr,kmaxr found in the file 8 | c 9 | c JMB 6/3/91 10 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 11 | c 12 | PARAMETER(KBLANC=10) 13 | real*4 c4(*) 14 | real*8 c8(*) 15 | c in the calling routin you can specify the following equivalence to 16 | c save memory space: 17 | c equivalence(c,c4) 18 | c equivalence(c,c8) 19 | c 20 | c skip KBLANC lines 21 | do 1 kb=1,KBLANC 22 | read(iu,ERR=99) 23 | 1 continue 24 | c 25 | read(iu) imaxc,jmaxc,kmaxc,iprec,nbmots,valexc 26 | c 27 | c pass the values read to the calling routine 28 | iprecr=iprec 29 | imaxr=imaxc 30 | jmaxr=jmaxc 31 | kmaxr=kmaxc 32 | nbmotr=nbmots 33 | valexr=valexc 34 | c 35 | c compute the number of full records to read and the remaining words 36 | nl=(imaxc*jmaxc*kmaxc)/nbmots 37 | ir=imaxc*jmaxc*kmaxc-nbmots*nl 38 | ide=0 39 | c 40 | c if pathological case, read only four values C0 and DCI,DCJ,DCK 41 | c and return 42 | c them as the two four elements of the array 43 | if(imaxc.lt.0.or.jmaxc.lt.0.or.kmaxc.lt.0) then 44 | nl=0 45 | ir=4 46 | endif 47 | c 48 | c 49 | c single precision 50 | if(iprec.eq.4) then 51 | do 10 kl=1,nl 52 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,nbmots) 53 | ide=ide+nbmots 54 | 10 continue 55 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,ir) 56 | else 57 | c 58 | c double precision 59 | if(iprec.eq.8) then 60 | do 20 kl=1,nl 61 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,nbmots) 62 | ide=ide+nbmots 63 | 20 continue 64 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,ir) 65 | else 66 | goto 99 67 | endif 68 | endif 69 | c 70 | return 71 | 99 continue 72 | write(*,*) 'Data error in UREADC, not a conform file' 73 | return 74 | 100 continue 75 | write(*,*) 'Data error in UREADC, EOF reached' 76 | write(*,*)' number of values retrieved:', (kl-1)*nbmots+kc-1 77 | 78 | return 79 | end 80 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/ureadc.f: -------------------------------------------------------------------------------- 1 | Subroutine UREADC(iu,c8,c4,valexr,iprecr,imaxr,jmaxr,kmaxr,nbmotr) 2 | c ====== 3 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 4 | c Reads the field C(I,J,K) from fortran unit iu 5 | c returns the field in the array c4 if the returned iprecr=4 6 | c returns the field in the array c8 if the returned iprecr=8 7 | c returns the values if imaxr,jmaxr,kmaxr found in the file 8 | c 9 | c JMB 6/3/91 10 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 11 | c 12 | PARAMETER(KBLANC=10) 13 | real*4 c4(*) 14 | real*8 c8(*) 15 | c in the calling routin you can specify the following equivalence to 16 | c save memory space: 17 | c equivalence(c,c4) 18 | c equivalence(c,c8) 19 | c 20 | c skip KBLANC lines 21 | do 1 kb=1,KBLANC 22 | read(iu,ERR=99) 23 | 1 continue 24 | c 25 | read(iu) imaxc,jmaxc,kmaxc,iprec,nbmots,valexc 26 | c 27 | c pass the values read to the calling routine 28 | iprecr=iprec 29 | imaxr=imaxc 30 | jmaxr=jmaxc 31 | kmaxr=kmaxc 32 | nbmotr=nbmots 33 | valexr=valexc 34 | c 35 | c compute the number of full records to read and the remaining words 36 | nl=(imaxc*jmaxc*kmaxc)/nbmots 37 | ir=imaxc*jmaxc*kmaxc-nbmots*nl 38 | ide=0 39 | c 40 | c if pathological case, read only four values C0 and DCI,DCJ,DCK 41 | c and return 42 | c them as the two four elements of the array 43 | if(imaxc.lt.0.or.jmaxc.lt.0.or.kmaxc.lt.0) then 44 | nl=0 45 | ir=4 46 | endif 47 | c 48 | c 49 | c single precision 50 | if(iprec.eq.4) then 51 | do 10 kl=1,nl 52 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,nbmots) 53 | ide=ide+nbmots 54 | 10 continue 55 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,ir) 56 | else 57 | c 58 | c double precision 59 | if(iprec.eq.8) then 60 | do 20 kl=1,nl 61 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,nbmots) 62 | ide=ide+nbmots 63 | 20 continue 64 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,ir) 65 | else 66 | goto 99 67 | endif 68 | endif 69 | c 70 | return 71 | 99 continue 72 | write(*,*) 'Data error in UREADC, not a conform file' 73 | return 74 | 100 continue 75 | write(*,*) 'Data error in UREADC, EOF reached' 76 | write(*,*)' number of values retrieved:', (kl-1)*nbmots+kc-1 77 | 78 | return 79 | end 80 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/divabestguess: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source divalogging 4 | 5 | infolog -- | tee -a $divalog 6 | infolog 'Best guess for the parameter estimation' | tee -a $divalog 7 | infolog -- | tee -a $divalog 8 | 9 | small="100" 10 | medium="2000" 11 | ndata=$(cat ./input/data.dat| wc -l) 12 | divaecho ======================================== 13 | divaecho Full parameter estimation 14 | divaecho ======================================== 15 | if [ "$ndata" -le "$small" ] 16 | then 17 | divaecho =============== 18 | divaecho Small data set 19 | divaecho =============== 20 | divafit -r 21 | else 22 | if [ "$ndata" -le "$medium" ] 23 | then 24 | divaecho =============== 25 | divaecho Medium data set 26 | divaecho =============== 27 | divafit -r 28 | else 29 | divaecho ============== 30 | divaecho Large data set 31 | divaecho ============== 32 | divafit $medium -r 33 | fi 34 | fi 35 | # OK, so now we have a first guess on L 36 | # Make the mesh accordingly (option -r already made the param.par) 37 | divamesh 38 | FIRSTL=$(head -2 ./input/param.par | tail -1) 39 | divaecho ========== 40 | divaecho L: $FIRSTL 41 | divaecho will try 42 | rm ./input/gcvsamplingL.dat 43 | echo $(echo $FIRSTL | awk '{print ($1*0.3)}') >> ./input/gcvsamplingL.dat 44 | echo $(echo $FIRSTL | awk '{print ($1*0.5)}') >> ./input/gcvsamplingL.dat 45 | echo $(echo $FIRSTL | awk '{print ($1*1.0)}') >> ./input/gcvsamplingL.dat 46 | echo $(echo $FIRSTL | awk '{print ($1*2.0)}') >> ./input/gcvsamplingL.dat 47 | echo $(echo $FIRSTL | awk '{print ($1*5.0)}') >> ./input/gcvsamplingL.dat 48 | echo ========== 49 | if [ -f ./output/gcvL.dat ] 50 | then 51 | divaecho Erasing old gcvL.dat 52 | rm ./output/gcvL.dat 53 | fi 54 | for Lgcv in `cat ./input/gcvsamplingL.dat` 55 | do 56 | divaecho Working with length scale $Lgcv 57 | # Prepare adapted param.par 58 | cp -v ./input/param.par ./input/param.par.oriL 59 | head -1 ./input/param.par.oriL > ./input/param.par 60 | echo $Lgcv >> ./input/param.par 61 | head -26 ./input/param.par.oriL | tail -24 >> ./input/param.par 62 | if [ "$ndata" -le "$small" ]; then 63 | divacv -r 64 | else 65 | if [ "$ndata" -le "$medium" ]; then 66 | divagcv -r 67 | else 68 | let nsamp=$(($ndata/20)) 69 | divacvrand $nsamp 2 -r 70 | fi 71 | fi 72 | # restore param.par 73 | cp -v ./input/param.par.oriL ./input/param.par 74 | cat ./output/gcv.dat >> ./output/gcvL.dat 75 | done 76 | 77 | infolog -- | tee -a $divalog 78 | infolog 'End parameter estimation' | tee -a $divalog 79 | infolog -- | tee -a $divalog 80 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/dvchpar: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C 3 | 4 | if [ "$#" != "2" ] 5 | then 6 | echo '==========================================' 7 | echo Usage: 8 | echo ' ' dvchpar parameter value 9 | echo Example: change signal/noise ratio to 0.1 10 | echo ' ' dvchpar SNR 0.1 11 | echo '==========================================' 12 | 13 | exit 14 | fi 15 | 16 | mv ./input/param.par ./input/param.par.dvchpar 17 | 18 | 19 | if [ "$1" == "LC" ]||[ "$1" == "lc" ]||[ "$1" == "length" ]||[ "$1" == "CL" ]||[ "$1" == "cl" ] 20 | then 21 | echo Changing correlation length to $2 22 | il=2 23 | fi 24 | 25 | if [ "$1" == "icoordchange" ]||[ "$1" == "icoord" ]||[ "$1" == "ICOORD" ] 26 | then 27 | echo Changing correlation length to $2 28 | il=4 29 | fi 30 | 31 | if [ "$1" == "ispec" ]||[ "$1" == "ISPEC" ] 32 | then 33 | echo Changing error ispec to $2 34 | il=6 35 | fi 36 | 37 | if [ "$1" == "ireg" ]||[ "$1" == "IREG" ] 38 | then 39 | echo Changing ireg to $2 40 | il=8 41 | fi 42 | 43 | if [ "$1" == "xori" ]||[ "$1" == "XORI" ]||[ "$1" == "x1" ] 44 | then 45 | echo Changing grid x origin to $2 46 | il=10 47 | fi 48 | 49 | if [ "$1" == "yori" ]||[ "$1" == "YORI" ]||[ "$1" == "y1" ] 50 | then 51 | echo Changing grid y origin to $2 52 | il=12 53 | fi 54 | 55 | if [ "$1" == "dx" ]||[ "$1" == "DX" ] 56 | then 57 | echo Changing grid spacing x to $2 58 | il=14 59 | fi 60 | 61 | if [ "$1" == "dy" ]||[ "$1" == "DY" ] 62 | then 63 | echo Changing grid spacing y to $2 64 | il=16 65 | fi 66 | 67 | 68 | if [ "$1" == "nx" ]||[ "$1" == "NX" ] 69 | then 70 | echo Changing number of x grid points $2 71 | il=18 72 | fi 73 | 74 | if [ "$1" == "ny" ]||[ "$1" == "NY" ] 75 | then 76 | echo Changing number of y grid points $2 77 | il=20 78 | fi 79 | 80 | 81 | if [ "$1" == "valex" ]||[ "$1" == "VALEX" ] 82 | then 83 | echo Changing exclussion value to $2 84 | il=22 85 | fi 86 | 87 | 88 | if [ "$1" == "SNR" ] 89 | then 90 | echo Changing signal to noise ratio to $2 91 | il=24 92 | fi 93 | 94 | 95 | if [ "$1" == "varbak" ]||[ "$1" == "VARBAK" ]||[ "$1" == "VARBACK" ]||[ "$1" == "varback" ] 96 | then 97 | echo Changing variance of background to $2 98 | il=26 99 | fi 100 | 101 | 102 | cat ./input/param.par.dvchpar | awk -v il=$il -v val=$2 '{ { if (FNR == il) { $1=val} }; print $0}' > ./input/param.par 103 | 104 | diff ./input/param.par.dvchpar ./input/param.par 105 | 106 | if [ -f ./input/param.par ] 107 | then 108 | rm ./input/param.par.dvchpar 109 | else 110 | echo Problem encountered 111 | mv ./input/param.par.dvchpar ./input/param.par 112 | fi -------------------------------------------------------------------------------- /DIVA3D/divastripped/divalogging: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Define functions to have color in the logging 3 | 4 | function divaecho(){ 5 | local bold=$(tput bold) 6 | local normal=$(tput sgr0) 7 | # echo -e ${bold}$(date +"%Y-%m-%dT%H:%M:%S") $(basename $0)${normal}: "$@" 8 | echo -e ${bold}$(basename $0)${normal}: "$@" 9 | } 10 | 11 | function infolog(){ 12 | local logcolor='\033[0;32m' 13 | local nocolor='\033[0m' 14 | if [ "${1}" == "--" ]; then 15 | echo -e "${logcolor}/////////////////////////////////////////${nocolor}" 16 | else 17 | echo -e "${logcolor}$(basename $0): $@ ${nocolor}" 18 | fi 19 | } 20 | 21 | function warnlog(){ 22 | local logcolor='\033[0;33m' 23 | local nocolor='\033[0m' 24 | if [ "${1}" == "!!" ]; then 25 | echo -e "${logcolor}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${nocolor}" 26 | else 27 | echo -e ${logcolor}$(basename $0): $@ ${nocolor} 28 | fi 29 | } 30 | 31 | function errorlog(){ 32 | local logcolor='\033[0;31m' 33 | local nocolor='\033[0m' 34 | if [ "${1}" == "!!" ]; then 35 | echo -e "${logcolor}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${nocolor}" 36 | else 37 | echo -e "${logcolor}$(basename $0): $@ ${nocolor}" 38 | fi 39 | 40 | } 41 | 42 | function hline(){ 43 | echo "-----------------------------------------" 44 | } 45 | 46 | function errorline(){ 47 | errorlog "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 48 | } 49 | 50 | function warnline(){ 51 | warnlog "??????????????????????????????????" 52 | } 53 | 54 | function infoline(){ 55 | infolog "///////////////////////////////" 56 | } 57 | 58 | function titleline(){ 59 | echo "##################################" 60 | } 61 | 62 | # Create different log files 63 | # -------------------------- 64 | 65 | divarundir=$(pwd) 66 | divalogdir=${divarundir}'/logs/' 67 | mkdir -pv ${divalogdir} 68 | 69 | divalog=${divalogdir}'diva.log' 70 | divacalclog=${divalogdir}'divacalc.log' 71 | divameshlog=${divalogdir}'divamesh.log' 72 | divafitlog=${divalogdir}'divafit.log' 73 | divadatalog=${divalogdir}'divadata.log' 74 | divagcvlog=${divalogdir}'divagcv.log' 75 | divacvlog=${divalogdir}'divacv.log' 76 | divacvrandlog=${divalogdir}'divacvrand.log' 77 | divacovariancelog=${divalogdir}'dvcovariance.log' 78 | dvcovariancelog=${divalogdir}'dvcovariance.log' 79 | divaanomlog=${divarundir}'divaanom.log' 80 | divacontlog=${divarundir}'divacont.log' 81 | divaintlog=${divarundir}'divaintegral.log' 82 | 83 | 84 | # Input files 85 | # ----------- 86 | 87 | inputdir=${divarundir}'/input/' 88 | contfile=${inputdir}'coast.cont' 89 | datafile=${inputdir}'data.dat' 90 | paramfile=${inputdir}'param.par' 91 | valatxyfile=${inputdir}'valatxy.coord' 92 | gcvsamplingfile=${inputdir}'gcvsampling.dat' 93 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/ureadc.F: -------------------------------------------------------------------------------- 1 | Subroutine UREADC(iu,c8,c4,valexr,iprecr,imaxr,jmaxr,kmaxr,nbmotr) 2 | c ====== 3 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 4 | c Reads the field C(I,J,K) from fortran unit iu 5 | c returns the field in the array c4 if the returned iprecr=4 6 | c returns the field in the array c8 if the returned iprecr=8 7 | c returns the values if imaxr,jmaxr,kmaxr found in the file 8 | c 9 | c JMB 6/3/91 10 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 11 | c 12 | PARAMETER(KBLANC=10) 13 | real*4 c4(*) 14 | real*8 c8(*) 15 | 16 | integer*4 iprecr,imaxr,jmaxr,kmaxr,nbmotr 17 | integer*4 imaxc,jmaxc,kmaxc,iprec,nbmots 18 | 19 | c in the calling routin you can specify the following equivalence to 20 | c save memory space: 21 | c equivalence(c,c4) 22 | c equivalence(c,c8) 23 | c 24 | c skip KBLANC lines 25 | do 1 kb=1,KBLANC 26 | read(iu,ERR=99) 27 | 1 continue 28 | c 29 | read(iu) imaxc,jmaxc,kmaxc,iprec,nbmots,valexc 30 | c 31 | c pass the values read to the calling routine 32 | iprecr=iprec 33 | imaxr=imaxc 34 | jmaxr=jmaxc 35 | kmaxr=kmaxc 36 | nbmotr=nbmots 37 | valexr=valexc 38 | c 39 | c compute the number of full records to read and the remaining words 40 | nl=(imaxc*jmaxc*kmaxc)/nbmots 41 | ir=imaxc*jmaxc*kmaxc-nbmots*nl 42 | ide=0 43 | c 44 | c if pathological case, read only four values C0 and DCI,DCJ,DCK 45 | c and return 46 | c them as the two four elements of the array 47 | if(imaxc.lt.0.or.jmaxc.lt.0.or.kmaxc.lt.0) then 48 | nl=0 49 | ir=4 50 | endif 51 | c 52 | c 53 | c single precision 54 | if(iprec.eq.4) then 55 | do 10 kl=1,nl 56 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,nbmots) 57 | ide=ide+nbmots 58 | 10 continue 59 | read(iu,ERR=99,END=100) (c4(ide+kc),kc=1,ir) 60 | else 61 | c 62 | c double precision 63 | if(iprec.eq.8) then 64 | do 20 kl=1,nl 65 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,nbmots) 66 | ide=ide+nbmots 67 | 20 continue 68 | read(iu,ERR=99,END=100) (c8(ide+kc),kc=1,ir) 69 | else 70 | goto 99 71 | endif 72 | endif 73 | c 74 | return 75 | 99 continue 76 | write(*,*) 'Data error in UREADC, not a conform file' 77 | return 78 | 100 continue 79 | write(*,*) 'Data error in UREADC, EOF reached' 80 | write(*,*)' number of values retrieved:', (kl-1)*nbmots+kc-1 81 | 82 | return 83 | end 84 | -------------------------------------------------------------------------------- /JRA4/Climatology/dvtxtmetainfo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILENAME=driver 4 | { 5 | read isextractcomm 6 | read isextractf 7 | read iscontourcomm 8 | read iscontour 9 | read isdatacleancomm 10 | read isdataclean 11 | read minimumdatanumbercomm 12 | read mindata 13 | read isoptimisecomm 14 | read isoptimise 15 | read CLMINcomm 16 | read CLMIN 17 | read CLMAXcomm 18 | read CLMAX 19 | read SNMINcomm 20 | read SNMIN 21 | read SNMAXcomm 22 | read SNMAX 23 | read isanalysiscomm 24 | read isanalysis 25 | read lowerlevelcomm 26 | read minlevel 27 | read upperlevelcomm 28 | read upperlevel 29 | read referencecomm 30 | read referenceflag 31 | read isplotcomm 32 | read isplot 33 | } < $FILENAME 34 | 35 | WDIR=$(pwd) 36 | jmtrend=$(cat driver | wc -l) 37 | 38 | echo " DIVA CLIMATOLOGY RUN INFORMATION FILE" 39 | echo " ****************************************" 40 | echo " ****************************************" 41 | echo " " 42 | echo " " 43 | echo " " 44 | date 45 | echo " " 46 | echo " " 47 | echo " " 48 | echo " Liste of variables:" 49 | echo " *******************" 50 | cat ./varlist 51 | echo " " 52 | echo " " 53 | echo " Liste of years:" 54 | echo " ***************" 55 | cat ./yearlist 56 | echo " " 57 | echo " " 58 | echo " Liste of months:" 59 | echo " ****************" 60 | cat ./monthlist 61 | echo " " 62 | echo " " 63 | echo " Driver flag values for actions performed:" 64 | echo " *****************************************" 65 | 66 | echo "Extract data .....................................: " $isextractf 67 | echo "Boundary lines and coastlines generation .........: " $iscontour 68 | echo "Data cleaning ....................................: " $isdataclean 69 | echo "Parameters optimisation ..........................: " $isoptimise 70 | echo "Perform analysis .................................: " $isanalysis 71 | echo "Gnu plots generation .............................: " $isplot 72 | 73 | if [ "$jmtrend" -ge "29" ] 74 | then 75 | ngrp=`head -30 ${WDIR}'/driver' | tail -1` 76 | fi 77 | echo "Perform detrending ...............................: " $ngrp 78 | echo " " 79 | echo " " 80 | 81 | echo " Driver bounds values:" 82 | echo " *********************" 83 | 84 | echo "Minimum data in a layer ..........................: "$mindata 85 | echo "Minimum value for correlation length .............: "$CLMIN 86 | echo "Maximum value for correlation length .............: "$CLMAX 87 | echo "Minimum value for signal to noise ratio...........: "$SNMIN 88 | echo "Maximum value for signal to noise ratio...........: "$SNMAX 89 | echo "Lower level considered ...........................: "$minlevel 90 | echo "Upper level considered ...........................: "$upperlevel 91 | echo " " 92 | echo " " 93 | -------------------------------------------------------------------------------- /DIVA3D/divastripped/test_calc_speed: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo ' ' 4 | echo 'divamesh with a decreasing correlation length (finer mesh)' 5 | echo ' ' 6 | 7 | ndatalist=(1000 5000 10000 50000 100000 500000 1000000 1500000) 8 | #ndatalist=(1000 5000 10000) # 50000 100000 500000 1000000 1500000) 9 | 10 | inputdir=$(pwd)'/input/' 11 | contfile=${inputdir}'coast.cont' 12 | paramfile=${inputdir}'param.par' 13 | datafile=${inputdir}'data.dat' 14 | tmpfile=$(mktemp) 15 | 16 | mkdir -pv logs 17 | 18 | # Add divaclean to avoid working on old files! 19 | divaclean 20 | 21 | ##echo ${inputdir} 22 | echo '1. Creating a simple contour file' 23 | echo ' ' 24 | 25 | echo 2 > ${contfile} 26 | echo 4 >> ${contfile} 27 | echo -1 -1 >> ${contfile} 28 | echo 1 -1 >> ${contfile} 29 | echo 1 1 >> ${contfile} 30 | echo -1 1 >> ${contfile} 31 | echo 4 >> ${contfile} 32 | echo 0.4 0.2 >> ${contfile} 33 | echo 0.4 0.8 >> ${contfile} 34 | echo 0.6 0.8 >> ${contfile} 35 | echo 0.6 0.2 >> ${contfile} 36 | 37 | 38 | echo '2. Creating base parameter file' 39 | echo ' ' 40 | 41 | echo '# Correlation Length lc' > ${paramfile} 42 | echo '.5' >> ${paramfile} 43 | echo '# icoordchange' >> ${paramfile} 44 | echo '0' >> ${paramfile} 45 | echo '# ispec' >> ${paramfile} 46 | echo '11' >> ${paramfile} 47 | echo '# ireg' >> ${paramfile} 48 | echo '0' >> ${paramfile} 49 | echo '# xori' >> ${paramfile} 50 | echo '-1' >> ${paramfile} 51 | echo '# yori' >> ${paramfile} 52 | echo '-1' >> ${paramfile} 53 | echo '# dx' >> ${paramfile} 54 | echo '0.02' >> ${paramfile} 55 | echo '# dy' >> ${paramfile} 56 | echo '0.02' >> ${paramfile} 57 | echo '# nx' >> ${paramfile} 58 | echo '101' >> ${paramfile} 59 | echo '#ny' >> ${paramfile} 60 | echo '101' >> ${paramfile} 61 | echo '# valex' >> ${paramfile} 62 | echo '-99' >> ${paramfile} 63 | echo '# snr' >> ${paramfile} 64 | echo '1.0' >> ${paramfile} 65 | echo '# varbak' >> ${paramfile} 66 | echo '1.0' >> ${paramfile} 67 | 68 | logfile='./logs/testcalc_'`date +%Y-%m-%d-%H-%M-%S`'.log' 69 | echo "Writing results in ${logfile}" 70 | echo 'Number of data points Time (seconds)' > ${logfile} 71 | 72 | # Generate the mesh 73 | ./divamesh 74 | 75 | # Loop on the listed values of correlation length 76 | for ndata in "${ndatalist[@]}" 77 | do 78 | echo "Working with ${ndata} data points" 79 | 80 | echo $ndata | awk '{NP=$1;{for (i = 1; i <= NP; i++) {x=-1+2*rand();y=-1+2*rand();z=sin(3.14*x)*cos(3.14*y)*exp(x+y);print x,y,z,1}}}' > ${datafile} 81 | 82 | timeinit=$(date +%s.%N) 83 | 84 | ./divacalc 85 | 86 | timeend=$(date +%s.%N) 87 | timecalc=$(echo ${timeend} ${timeinit} | awk '{print ($1-$2)}') 88 | 89 | echo ${ndata} ${timecalc} >> ${logfile} 90 | 91 | done 92 | 93 | echo "Check results of the test in ${logfile}" 94 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/divacompile_options: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Name of the fortran compiler 4 | #----------------------------- 5 | 6 | compiler="gfortran" 7 | #compiler=ifort 8 | 9 | # To use parall version, put value to 1 10 | #------------------------------------- 11 | DIVA_PARALLEL=1 12 | # 13 | 14 | # Compilation flags 15 | #----------------- 16 | 17 | # !!! The flag -DDIVAHUGEMEMORY allow larger analysis and/or finer meshes. Disable it in case of compilation problems. 18 | 19 | flags='-O3 -frecord-marker=4 -cpp -DDIVAITERATIVE' # -DDIVAHUGEMEMORY' # ' -DDIVABINARYFILESMESH -DDIVABINARYFILES ' 20 | #flags='-O3' # no optimization 21 | 22 | flagscalc=' -O3 -cpp -DDIVAITERATIVE -Wall -fbounds-check ' #-DDIVAHUGEMEMORY' 23 | # -DALLODYZERO if ZEROS in ALLODY to be forced, time consuming... 24 | 25 | if [ "$DIVA_PARALLEL" = 1 ] 26 | then 27 | echo Going to use parallel version 28 | flagscalc='-O3 -cpp -fopenmp -DDIVAITERATIVE -DDIVAPARALLEL -DDIVAHUGEMEMORY' # -DDIVABINARYFILESMESH -DDIVABINARYFILES ' #' 29 | echo $flagscalc 30 | 31 | fi 32 | 33 | # Netcdf library 34 | #--------------- 35 | 36 | ncconfigok=$(type -P nc-config | wc -l) 37 | nfconfigok=$(type -P nf-config | wc -l) 38 | 39 | ### added tests on nc-config ### 40 | nclib=`nc-config --flibs` 41 | ncinc=`nc-config --fflags` 42 | nccompiler=`nc-config --fc` 43 | 44 | if [ "$nclib" == "" ] 45 | then 46 | ncconfigok="0" 47 | fi 48 | 49 | if [ "$ncinc" == "" ] 50 | then 51 | ncconfigok="0" 52 | fi 53 | 54 | if [ "$nccompiler" == "" ] 55 | then 56 | ncconfigok="0" 57 | fi 58 | ### ### 59 | 60 | echo nc-config $ncconfigok 61 | echo nf-config $nfconfigok 62 | 63 | if [ "$ncconfigok" != "0" ] 64 | then 65 | nclib=`nc-config --flibs` 66 | echo "nclib="$nclib 67 | ncinc=`nc-config --fflags` 68 | echo "ncinc="$ncinc 69 | compiler=`nc-config --fc` 70 | echo "compiler="$compiler 71 | else 72 | if [ "$nfconfigok" != "0" ] 73 | then 74 | nclib=`nf-config --flibs` 75 | # or by hand 76 | # nclib=/usr/lib/libnetcdff.dll.a 77 | echo "nclib="$nclib 78 | ncinc=`nf-config --fflags` 79 | echo "ncinc="$ncinc 80 | compiler=`nf-config --fc` 81 | echo "compiler="$compiler 82 | else 83 | # put netcdlibrary by hand 84 | nclib=/usr/lib/libnetcdff.dll.a 85 | ncinc=-I/usr/include 86 | fi 87 | fi 88 | # Use of Plplot (creation of scientific plots) 89 | #-------------- 90 | 91 | Plplot=Plplot 92 | Plplot=NoPlplot 93 | 94 | # gui = 1 for Graphical User Interface programs to be compiled 95 | gui=1 96 | 97 | # netcdf = 1 for NetCDF programs to be compiled 98 | netcdf=1 99 | 100 | echo 'flags = '${flags} 101 | echo 'flagscalc = '${flagscalc} 102 | echo 'ncinc = '${ncinc} 103 | echo 'nclib = '${nclib} 104 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Extensions/uwritc.f: -------------------------------------------------------------------------------- 1 | Subroutine UWRITC(iu,c8,c4,valexc,iprec,imaxc,jmaxc,kmaxc,nbmots) 2 | c ====== 3 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 4 | c writes the field C(I,J,K) into fortran unit iu 5 | c writes the field in the array c4 if iprecr=4 6 | c writes the field in the array c8 if iprecr=8 7 | c 8 | c The KBLANC blank lines are at the disposal of the user 9 | c JMB 6/3/92 10 | c 11 | c IF c(i,j,k)=NaN or infinity, it is replaced by VALEX! 12 | c 13 | c 14 | c RS 12/1/93 15 | c 16 | c If nbmots = -1 then write only 1 data record 17 | c (only for non-degenerated data) 18 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 19 | c 20 | PARAMETER(KBLANC=10) 21 | real*4 c4(*) 22 | real*8 c8(*) 23 | c in the calling routin you can specify the following equivalence to 24 | c save memory space: 25 | c equivalence(c,c4) 26 | c equivalence(c,c8) 27 | c 28 | c Putting Valex where not numbers 29 | z=0. 30 | un=1. 31 | ich=0 32 | ioff=1 33 | if( (imaxc.gt.0).and.(jmaxc.gt.0).and.(kmaxc.gt.0) ) then 34 | 35 | IF (NBMOTS.EQ.-1) NBMOTS = IMAXC*JMAXC*KMAXC 36 | 37 | endif 38 | c 39 | c skip KBLANC lines 40 | do 1 kb=1,KBLANC 41 | write(iu,ERR=99) 42 | 1 continue 43 | c 44 | write(iu) imaxc,jmaxc,kmaxc,iprec,nbmots,valexc 45 | c 46 | c compute the number of full records to read and the remaining words 47 | nl=(imaxc*jmaxc*kmaxc)/nbmots 48 | ir=imaxc*jmaxc*kmaxc-nbmots*nl 49 | ide=0 50 | c 51 | c if pathological case, write only four values C0 and DCI,DCJ,DCK found 52 | c as the two four elements of the array so that C(I,J,K) = 53 | c C0 + I * DCI + J * DCJ + K * DCK 54 | if(imaxc.lt.0.or.jmaxc.lt.0.or.kmaxc.lt.0) then 55 | nl=0 56 | ir=4 57 | endif 58 | c 59 | c 60 | c single precision 61 | if(iprec.eq.4) then 62 | do 10 kl=1,nl 63 | write(iu,ERR=99) (c4(ide+kc),kc=1,nbmots) 64 | ide=ide+nbmots 65 | 10 continue 66 | write(iu,ERR=99) (c4(ide+kc),kc=1,ir) 67 | else 68 | c 69 | c double precision 70 | if(iprec.eq.8) then 71 | do 20 kl=1,nl 72 | write (iu,ERR=99) (c8(ide+kc),kc=1,nbmots) 73 | ide=ide+nbmots 74 | 20 continue 75 | write (iu,ERR=99) (c8(ide+kc),kc=1,ir) 76 | else 77 | goto 99 78 | endif 79 | endif 80 | c 81 | return 82 | 99 continue 83 | write(*,*) 'Data error in UWRITC, not a conform file' 84 | write(*,*) 'imaxc,jmaxc,kmaxc,iprec,nbmots,valexc' 85 | write(*,*) imaxc,jmaxc,kmaxc,iprec,nbmots,valexc 86 | return 87 | end 88 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # Pass variables from the top-level make 3 | # (Variables are not normally passed down) 4 | 5 | DIVA_PARALLEL=1 6 | 7 | export compiler=gfortran 8 | 9 | 10 | export flags=-O3 -frecord-marker=4 -cpp -DDIVAITERATIVE -fallow-argument-mismatch 11 | ifeq ($(DIVA_PARALLEL), 1) 12 | export flagscalc=-O3 -cpp -fopenmp -DDIVAITERATIVE -DDIVAPARALLEL -DDIVAHUGEMEMORY -fallow-argument-mismatch 13 | else 14 | export flagscalc=-O3 -cpp -DDIVAITERATIVE -Wall -fbounds-check -DDIVAHUGEMEMORY -fallow-argument-mismatch 15 | endif 16 | 17 | 18 | export nclib=$(shell nf-config --flibs) 19 | export ncinc=$(shell nf-config --fflags) -fallow-argument-mismatch 20 | 21 | #export ncinc=-I/usr/local/include 22 | #export nclib=-L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdf -lnetcdf 23 | 24 | # For ifort (adapt path to ifort compiled netCDF library) 25 | #export compiler=ifort 26 | #export flagscalc='-O3 -xHost -ip -no-prec-div -static-intel -cpp -DDIVAITERATIVE -Wall -fbounds-check' 27 | #export ncinc=-I/home/ctroupin/Software/netCDF/include 28 | #export nclib=-L/home/ctroupin/Software/netCDF/lib -lnetcdff -L/home/ctroupin/Software/netCDF/lib -lnetcdf -lnetcdf 29 | 30 | # export nocyg=... 31 | # export noglobals=... 32 | 33 | export SRCDIR=$(PWD) 34 | export BINDIR=$(SRCDIR)/../../bin/ 35 | export DIVA2DDIR=$(SRCDIR)/../../divastripped 36 | export DIVAWORKDIR=$(DIVA2DDIR)/divawork/ 37 | export DIVAMESHDIR=$(DIVA2DDIR)/meshgenwork/ 38 | export DIVAINPUTDIR=$(DIVA2DDIR)/input/ 39 | export DIVAOUTPUTDIR=$(DIVA2DDIR)/output/ 40 | export DIVANCDIR=$(DIVA2DDIR)/output/ghertonetcdf/ 41 | export DIVAMESHVISUDIR=$(DIVA2DDIR)/output/meshvisu/ 42 | 43 | 44 | export MKDIR=mkdir -p 45 | PLPLOT = Plplot 46 | PLPLOT = NoPlplot # Comment this line of you have Plplot installed 47 | 48 | 49 | .PHONY: all calc extensions mesh netcdf pipetest stabil util directories cleanobject cleanexec 50 | 51 | all: calc extensions mesh netcdf pipetest stabil util directories 52 | 53 | test: 54 | @echo $(PWD) 55 | @echo "nclib: " $(nclib) 56 | @echo "ncinc: " $(ncinc) 57 | 58 | directories: $(DIVAWORKDIR) $(DIVAMESHDIR) $(DIVAINPUTDIR) $(DIVAOUTPUTDIR) $(DIVANCDIR) $(DIVAMESHVISUDIR) $(BINDIR) 59 | 60 | $(DIVAWORKDIR) $(DIVAMESHDIR) $(DIVAINPUTDIR) $(DIVAOUTPUTDIR) $(DIVANCDIR) $(DIVAMESHVISUDIR) $(BINDIR): 61 | $(MKDIR) $@ 62 | 63 | calc: 64 | $(MAKE) -C Calc 65 | 66 | extensions: 67 | $(MAKE) -C Extensions 68 | 69 | mesh: 70 | $(MAKE) -C Mesh 71 | 72 | netcdf: 73 | $(MAKE) -C NC 74 | 75 | pipetest: 76 | $(MAKE) -C Pipetest 77 | 78 | stabil: 79 | $(MAKE) -C Stabil 80 | 81 | util: 82 | $(MAKE) -C Util 83 | 84 | # Utility targets 85 | 86 | clean: cleanexec cleanobject 87 | 88 | cleanexec: 89 | rm -f $(BINDIR)*.a 90 | 91 | cleanobject: 92 | rm -f */*.o */*.mod 93 | -------------------------------------------------------------------------------- /DIVA3D/src/Fortran/Stabil/refebintrans.F: -------------------------------------------------------------------------------- 1 | ! 2 | PROGRAM RefeBinTrans 3 | ! 4 | implicit none 5 | ! 6 | !---------------------------------------------------------------------! 7 | ! 8 | real*8 :: W8 9 | REAL*4, DIMENSION(:) , ALLOCATABLE :: U, VECFLD 10 | real*4 :: VALEXC 11 | real*4 :: xorig, yorig, dx, dy, xend, yend 12 | ! 13 | integer :: i,j,ii,jj,ic,n 14 | integer :: NX, NY, NK, itrans,nbval,nbval2 15 | integer*4 :: KMAX, ipr, nw, IMAX, JMAX, flag 16 | ! 17 | CHARACTER (len=255) :: file_name,divafile,comments 18 | CHARACTER (len=99) :: EXECIN 19 | CHARACTER (len=99) :: BINFILE, ASCFILE, DTPFILE 20 | CHARACTER (len=99) :: var_name 21 | ! 22 | LOGICAL :: exist 23 | !-------------------------------------------------------------- 24 | ! 25 | EXECIN='./fort.44' 26 | OPEN(44,FILE=EXECIN,STATUS='OLD') 27 | READ(44,'(a)')BINFILE 28 | READ(44,*)itrans 29 | CLOSE(44) 30 | 31 | WRITE(divafile, 32 | &'("../input/divarefe/",a)')TRIM(BINFILE) 33 | !-------------------------------------------------------------- 34 | file_name = '../input/divarefe/GridInfo.dat' 35 | open(unit=90,file=TRIM(file_name)) 36 | read(90,*) xorig 37 | read(90,*) yorig 38 | read(90,*) dx 39 | read(90,*) dy 40 | read(90,*) xend 41 | read(90,*) yend 42 | CLOSE(90) 43 | ! 44 | !-------------------------------------------------------------- 45 | ! 46 | ! Reading param.par 47 | ! 48 | NX = INT(xend) 49 | NY = INT(yend) 50 | ! 51 | ALLOCATE(U(NX*NY)) 52 | ALLOCATE(VECFLD(NX*NY)) 53 | ! 54 | IMAX = NX 55 | JMAX = NY 56 | close(84) 57 | open (unit=84,file=TRIM(divafile),form='unformatted') 58 | CALL UREADC(84,W8,U,VALEXC,IPR,IMAX,JMAX,KMAX,IMAX*JMAX) 59 | ! 60 | !trtrtrtrtrtrtrtrtrtrtrtrtrtrtttrttttrtrtrtrt 61 | ! 62 | nbval = 0 63 | DO i=1,NX*NY 64 | IF(U(i) .ne. VALEXC) THEN 65 | nbval = nbval+1 66 | VECFLD(nbval) = U(i) 67 | ENDIF 68 | ENDDO 69 | ! 70 | CALL TRANSFUN(itrans,nbval,VECFLD) 71 | ! 72 | nbval2 = 0 73 | DO i=1,NX*NY 74 | IF(U(i) .ne. VALEXC) THEN 75 | nbval2 = nbval2+1 76 | U(i) = VECFLD(nbval2) 77 | ENDIF 78 | ENDDO 79 | ! 80 | !trtrtrtrtrtrtrtrtrtrtrtrtrtrtttrttttrtrtrtrt 81 | ! 82 | KMAX = 1 83 | ipr=4 84 | close(84) 85 | open (unit=84,file=TRIM(divafile),form='unformatted') 86 | CALL UWRITC(84,W8,U,VALEXC,IPR,IMAX,JMAX,KMAX,IMAX) 87 | ! 88 | STOP 89 | END 90 | --------------------------------------------------------------------------------