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