forked from inogs/bit.sea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
limval_Ispra.py
106 lines (89 loc) · 3.6 KB
/
limval_Ispra.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import scipy.io.netcdf as NC
import numpy as np
import os
from commons.layer import Layer
from commons.mask import Mask
from profilerIspra import *
import basins.OGS as OGS
import basins.V2 as V2
from instruments import lovbio_float
from instruments import var_conversions
from static.Ispra_reader import *
from loadIspraDistances import statExcludeInt,statExcludeDist
M = Matchup_Manager(ISPRA_PROFILES,TL,BASEDIR)
OUTDIR = '/pico/scratch/userexternal/ateruzzi/ELAB_DA_COAST/DATI_ISPRA/SKILL_DIAG/OUT_MATCHUP_' + RUN + '/'
MASKFILE = '/pico/scratch/userexternal/ateruzzi/DA_COAST_18/wrkdir/MODEL/meshmask.nc'
TheMask = Mask(MASKFILE)
nav_lev = TheMask.zlevels
VARLIST = ['N1p','N3n','P_l']
#VARLIST = ['N3n']
#SEASLIST = ['winter','spring','summer','autumn']
SEASLIST = ['win-spr','sum-aut']
DICT_seas = {
'winter': TimeInterval('20130101','20130331','%Y%m%d'),
'spring': TimeInterval('20130401','20130630','%Y%m%d'),
'summer': TimeInterval('20130701','20130930','%Y%m%d'),
'autumn': TimeInterval('20131001','20131231','%Y%m%d'),
'win-spr': TimeInterval('20130101','20130630','%Y%m%d'),
'sum-aut': TimeInterval('20130701','20131231','%Y%m%d'),
}
AreasList = ['adr1','adr2','tyr1','tyr2','ion3','adriatic','allmed']
dictArea = {
'adriatic' : V2.ComposedBasin('adr',[V2.adr1,V2.adr2]),
'adr1' : V2.adr1,
'adr2' : V2.adr2,
'tyr1' : V2.tyr1,
'tyr2' : V2.tyr2,
'ion3' : V2.ion3,
'allmed' : V2.med
}
if __name__ == '__main__':
N = IspraReader()
layer = Layer(0,3)
statExclude = ['12-T2_21A','12-T2_24A','12-T2_24','12-T2_21']
LIMITS = np.ones((len(VARLIST),len(SEASLIST),len(AreasList)))*np.nan
print(RUN)
for iarea,area in enumerate(AreasList):
print('================')
print(area)
for ivar,var in enumerate(VARLIST):
print('----------------')
print(var)
varname=var_conversions.ISPRAVARS[var]
for iseas,seas in enumerate(SEASLIST):
print('................')
print(seas)
TI = DICT_seas[seas]
Profilelist = N.Selector(varname,TI,dictArea[area])
print(len(Profilelist))
iexc = 0
iexcInt = 0
iexcDist = 0
newList = []
for p in Profilelist:
#if p.name() in statExclude:
# print('removing station 12-T2_21A or 24A or 24 or 21')
# Profilelist.remove(p)
# iexc += 1
condexc1 = p.name().startswith('12-T2_21')
condexc4 = p.name().startswith('12-T2_24')
condexcI = p.name() in statExcludeInt
condexcD = p.name() in statExcludeDist
condexc = condexc1 | condexc4 | condexcI | condexcD
if condexc1:
print(p.name())
#Profilelist.remove(p)
iexc += 1
if condexc:
continue
else:
newList.append(p)
#L = M.getMatchups(Profilelist, nav_lev, var)
L = M.getMatchups(newList, nav_lev, var)
Llayer = L.subset(layer)
LIMITS[ivar,iseas,iarea] = 1.2*Llayer.Model.max()
print(len(Profilelist),iexc,iexcInt,iexcDist)
print(len(newList))
print(LIMITS[ivar,iseas,iarea])
outfile = OUTDIR + 'limits'+ RUN + '.npy'
np.save(outfile,LIMITS)