annotate divandfull.jl @ 0:484930fdc002 draft

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
author ecology
date Thu, 01 Aug 2024 09:46:44 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
1 #Julia script
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
2
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
3 ###############################
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
4 ## DIVAndrun analsysis ##
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
5 ###############################
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
6 import Pkg;
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
7 using Pkg
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
8 Pkg.status()
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
9
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
10 ### Import packages
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
11 using DIVAnd
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
12 using Dates
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
13 using Printf
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
14 # Getting the arguments from the command line
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
15 args = ARGS
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
16
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
17 # Import data
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
18 if length(args) < 4
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
19 error("This tool needs at least 4 arguments")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
20 else
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
21 netcdf_data = args[1]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
22 longmin = parse(Float64, args[2])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
23 longmax = parse(Float64, args[3])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
24 latmin = parse(Float64, args[4])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
25 latmax = parse(Float64, args[5])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
26 startdate = args[6] # yyyy,mm,dd
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
27 enddate = args[7]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
28 varname = args[8]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
29 selmin = parse(Float64, args[9])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
30 selmax = parse(Float64, args[10])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
31 bathname = args[11]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
32 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
33
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
34 ## This script will create a climatology:
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
35 # 1. ODV data reading.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
36 # 2. Extraction of bathymetry and creation of mask
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
37 # 3. Data download from other sources and duplicate removal.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
38 # 4. Quality control.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
39 # 5. Parameter optimisation.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
40 # 6. Spatio-temporal interpolation with DIVAnd.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
41
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
42
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
43 ### Configuration
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
44 # Define the horizontal, vertical (depth levels) and temporal resolutions.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
45 # Select the variable of interest
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
46
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
47 dx, dy = 0.125, 0.125
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
48 lonr = longmin:dx:longmax
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
49 latr = latmin:dy:latmax
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
50
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
51 # Convert string in date
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
52 startdate = Date(startdate, "yyyy-mm-dd")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
53
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
54 # extract year month day
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
55 startyear = year(startdate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
56 startmonth = month(startdate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
57 startday = day(startdate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
58
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
59 # Convert string in date
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
60 enddate = Date(enddate, "yyyy-mm-dd")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
61
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
62 # extract year month day
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
63 endyear = year(enddate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
64 endmonth = month(enddate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
65 endday = day(enddate)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
66
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
67 timerange = [Date(startyear, startmonth, startday),Date(endyear, endmonth, endday)];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
68
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
69 depthr = [0.,5., 10., 15., 20., 25., 30., 40., 50., 66,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
70 75, 85, 100, 112, 125, 135, 150, 175, 200, 225, 250,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
71 275, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
72 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
73 1300, 1350, 1400, 1450, 1500, 1600, 1750, 1850, 2000];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
74 depthr = [0.,10.,20.];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
75
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
76 varname = varname
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
77 yearlist = [1900:2023];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
78 monthlist = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
79
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
80 # We create here the variable TS (for "tDataset(netcdf_data,"r")ime selector"), which allows us to work with the observations corresponding to each period of interest.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
81
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
82 TS = DIVAnd.TimeSelectorYearListMonthList(yearlist,monthlist);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
83 @show TS;
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
84
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
85 figdir = "outputs/"
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
86 if ~(isdir(figdir))
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
87 mkdir(figdir)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
88 else
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
89 @info("Figure directory already exists")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
90 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
91 ### 1. Read your ODV file
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
92 # Adapt the datadir and datafile values.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
93 # The example is based on a sub-setting of the Mediterranean Sea aggregated dataset.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
94 # The dataset has been extracted around the Adriatic Sea and exported to a netCDF using Ocean Data
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
95 datadir = "../data"
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
96
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
97 datafile = netcdf_data
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
98
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
99 # Then you can read the full file:
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
100 @time obsval,obslon,obslat,obsdepth,obstime,obsid = NCODV.load(Float64, datafile,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
101 "Water body $(varname)");
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
102
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
103 # Check the extremal values of the observations
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
104 checkobs((obslon,obslat,obsdepth,obstime),obsval,obsid)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
105
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
106 ### 2. Extract the bathymetry
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
107
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
108 # It is used to delimit the domain where the interpolation is performed.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
109 ## 2.1 Choice of bathymetry
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
110
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
111 # Modify bathname according to the resolution required.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
112
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
113 @time bx,by,b = load_bath(bathname,true,lonr,latr);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
114
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
115 ## 2.2 Create mask
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
116 # False for sea
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
117 # True for land
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
118
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
119 mask = falses(size(b,1),size(b,2),length(depthr))
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
120 for k = 1:length(depthr)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
121 for j = 1:size(b,2)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
122 for i = 1:size(b,1)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
123 mask[i,j,k] = b[i,j] >= depthr[k]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
124 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
125 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
126 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
127 @show size(mask)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
128
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
129 ### 3. Quality control
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
130 # We check the salinity value.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
131 # Adapt the criteria to your region and variable.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
132
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
133 sel = (obsval .<= selmax) .& (obsval .>= selmin);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
134
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
135 obsval = obsval[sel]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
136 obslon = obslon[sel]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
137 obslat = obslat[sel]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
138 obsdepth = obsdepth[sel]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
139 obstime = obstime[sel]
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
140 obsid = obsid[sel];
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
141
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
142 ### 4. Analysis parameters
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
143 # Correlation lengths and noise-to-signal ratio
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
144
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
145 # We will use the function diva3D for the calculations.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
146 # With this function, the correlation length has to be defined in meters, not in degrees.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
147
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
148 sz = (length(lonr),length(latr),length(depthr));
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
149 lenx = fill(100_000.,sz) # 100 km
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
150 leny = fill(100_000.,sz) # 100 km
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
151 lenz = fill(25.,sz); # 25 m
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
152 len = (lenx, leny, lenz);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
153 epsilon2 = 0.1;
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
154
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
155 ### Output file name
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
156 outputdir = "outputs_netcdf/"
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
157 if !isdir(outputdir)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
158 mkpath(outputdir)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
159 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
160 filename = joinpath(outputdir, "Water_body_$(replace(varname," "=>"_")).nc")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
161
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
162 ### 7. Analysis
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
163 # Remove the result file before running the analysis, otherwise you'll get the message
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
164 if isfile(filename)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
165 rm(filename) # delete the previous analysis
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
166 @info "Removing file $filename"
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
167 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
168
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
169 ## 7.1 Plotting function
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
170 # Define a plotting function that will be applied for each time index and depth level.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
171 # All the figures will be saved in a selected directory.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
172
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
173 function plotres(timeindex,sel,fit,erri)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
174 tmp = copy(fit)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
175 nx,ny,nz = size(tmp)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
176 for i in 1:nz
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
177 figure("Additional-Data")
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
178 ax = subplot(1,1,1)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
179 ax.tick_params("both",labelsize=6)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
180 ylim(39.0, 46.0);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
181 xlim(11.5, 20.0);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
182 title("Depth: (timeindex)", fontsize=6)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
183 pcolor(lonr.-dx/2.,latr.-dy/2, permutedims(tmp[:,:,i], [2,1]);
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
184 vmin = 33, vmax = 40)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
185 colorbar(extend="both", orientation="vertical", shrink=0.8).ax.tick_params(labelsize=8)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
186
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
187 contourf(bx,by,permutedims(b,[2,1]), levels = [-1e5,0],colors = [[.5,.5,.5]])
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
188 aspectratio = 1/cos(mean(latr) * pi/180)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
189 gca().set_aspect(aspectratio)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
190
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
191 figname = varname * @sprintf("_%02d",i) * @sprintf("_%03d.png",timeindex)
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
192 plt.savefig(joinpath(figdir, figname), dpi=600, bbox_inches="tight");
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
193 plt.close_figs()
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
194 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
195 end
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
196
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
197 ## 7.2 Create the gridded fields using diva3d
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
198 # Here only the noise-to-signal ratio is estimated.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
199 # Set fitcorrlen to true to also optimise the correlation length.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
200 @time dbinfo = DIVAnd.diva3d((lonr,latr,depthr,TS),
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
201 (obslon,obslat,obsdepth,obstime), obsval,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
202 len, epsilon2,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
203 filename,varname,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
204 bathname=bathname,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
205 fitcorrlen = false,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
206 niter_e = 2,
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
207 surfextend = true
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
208 );
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
209
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
210 # Save the observation metadata in the NetCDF file.
484930fdc002 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ocean commit e395cfee9cab90bbed58ac52fb8467c896f51824
ecology
parents:
diff changeset
211 DIVAnd.saveobs(filename,(obslon,obslat,obsdepth,obstime),obsid);