Exemplo n.º 1
0
f = open(idate0 + "." + VARLIST[0] + "_arg_mis.dat", "w")  # OUTPUT x il 3DVAR

iniz = "     \n"
f.writelines(iniz)

# LIST of profiles for the selected variable in VARLIST
# in the interval idate1.time_interval in the mediterranean area
Profilelist_1 = bio_float.FloatSelector(LOVFLOATVARS[VARLIST[0]],
                                        idate1.time_interval, OGS.med)
TL = TimeList.fromfilenames(idate2.time_interval,
                            INPUTDIR,
                            "ave.*.nc",
                            filtervar="P_l")
TL.inputFrequency = 'weekly'
M = Matchup_Manager(Profilelist_1, TL, BASEDIR)

#import sys
#sys.exit()

# LIST of FLOATS (WMO) that are in Profilelist_1
WMOlist = bio_float.get_wmo_list(Profilelist_1)
nWMO = len(WMOlist)  #NUMBER OF float IN THE SELECTED PERIOD

totallines = 0
for wmo in WMOlist:
    #for ind in np.arange(0,1):
    #        wmo=WMOlist[ind]
    print wmo

    # SAVE in the "Goodlist" all the profiles for a given FLOAT ID
Exemplo n.º 2
0
    return parser.parse_args()


args = argument()

import numpy as np
from commons.mask import Mask
from instruments.matchup_manager import Matchup_Manager
from profiler_RA import *
import basins.OGS as OGS
from instruments.var_conversions import NUTRVARS
from static.Nutrients_reader import NutrientsReader
from commons.layer import Layer

M = Matchup_Manager(ALL_PROFILES, TL, BASEDIR)
N = NutrientsReader()

TheMask = Mask(args.maskfile)
nav_lev = TheMask.zlevels

SUBlist = [sub for sub in OGS.P]
SUBlist.extend([OGS.wes, OGS.eas])


LAYERLIST = [
    Layer(0, 10),
    Layer(10, 50),
    Layer(50, 100),
    Layer(100, 150),
    Layer(150, 300),
Exemplo n.º 3
0
from instruments.matchup_manager import Matchup_Manager
import basins.OGS as OGS
from instruments import lovbio_float as bio_float
from commons.mask import Mask
from commons.utils import addsep
from datetime import timedelta
from datetime import datetime
from commons import timerequestors

meantime = datetime.strptime(args.time, '%Y%m%d')

INPUTDIR = addsep(args.inputdir)
BASEDIR = addsep(args.basedir)

TI_week = timerequestors.Weekly_req(meantime.year, meantime.month,
                                    meantime.day).time_interval
TI_day = timerequestors.Daily_req(meantime.year, meantime.month,
                                  meantime.day).time_interval

Profilelist = bio_float.FloatSelector(None, TI_week, OGS.med)
TL = TimeList.fromfilenames(TI_day, INPUTDIR, "ave*.nc", filtervar="P_l")
TL.inputFrequency = 'weekly'
M = Matchup_Manager(Profilelist, TL, BASEDIR)

profilerscript = BASEDIR + 'jobProfiler.sh'
descriptor = "/pico/scratch/userexternal/lmariott/FLOAT_DA_01/wrkdir/float_preproc/VarDescriptor.xml"
M.writefiles_for_profiling(
    descriptor, profilerscript,
    aggregatedir=INPUTDIR)  # preparation of data for aveScan
M.dumpModelProfiles(profilerscript)  # sequential launch of aveScan
Exemplo n.º 4
0
# location of input big ave files, usually the TMP directory.
# ave files are supposed to have N3n, O2o and chl
INPUTDIR="/pico/scratch/userexternal/gbolzon0/PROFILATORE/AVE/"

# output directory, where aveScan.py will be run.
BASEDIR='/pico/scratch/userexternal/gbolzon0/PROFILATORE/'

DATESTART = '20150901-00:00:00'
DATE__END = '20150917-00:00:00'

T_INT = TimeInterval(DATESTART,DATE__END, '%Y%m%d-%H:%M:%S')
TL = TimeList.fromfilenames(T_INT, INPUTDIR,"ave*.nc")

ALL_PROFILES = instruments.getAllProfiles(T_INT)

vardescriptorfile="VarDescriptor_valid_online.xml"
#This previous part will be imported in matchups setup.

# The following part, the profiler, is executed once and for all.
# It might take some time, depending on length of simulation or size of files.
if __name__ == '__main__':
    # Here instruments time and positions are read as well as model times
    M = Matchup_Manager(ALL_PROFILES,TL,BASEDIR)


    profilerscript = BASEDIR + 'jobProfiler.sh'

    M.writefiles_for_profiling(vardescriptorfile, profilerscript) # preparation of data for aveScan

    M.dumpModelProfiles(profilerscript) # sequential launch of aveScan
Exemplo n.º 5
0
matplotlib.use('Agg')
from commons.time_interval import TimeInterval
from commons.Timelist import TimeList
from instruments.matchup_manager import Matchup_Manager
import basins.OGS as OGS
from instruments import lovbio_float as bio_float
from commons.mask import Mask
from commons.utils import addsep
from datetime import timedelta

starttime=args.starttime
end__time=args.endtime
INPUTDIR=addsep(args.inputdir)
BASEDIR=addsep(args.basedir)


TI=TimeInterval(starttime,end__time,'%Y%m%d')
TI.end_time = TI.end_time + timedelta(1)

TheMask=Mask(args.maskfile)

Profilelist=bio_float.FloatSelector(None,TI,OGS.med)
TL = TimeList.fromfilenames(TI, INPUTDIR,"ave*.nc")
M = Matchup_Manager(Profilelist,TL,BASEDIR)

profilerscript = BASEDIR + 'jobProfiler.sh'
M.writefiles_for_profiling('VarDescriptor_valid_online.xml', profilerscript) # preparation of data for aveScan
M.dumpModelProfiles(profilerscript) # sequential launch of aveScan

M.getFloatMatchups(Profilelist,TheMask.zlevels,args.outdir)
Exemplo n.º 6
0
d = datetime.datetime.strptime(datestr,'%Y%m%d')
R=timerequestors.Weekly_req(d.year,d.month,d.day)

LAYERLIST=[Layer(0,10), Layer(10,30), Layer(30,60), Layer(60,100), Layer(100,150), Layer(150,300), Layer(300,600), Layer(600,1000)]
VARLIST = ['P_l','N3n','O2o']
read_adjusted = [True,False,False]
nSub   = len(OGS.NRT3.basin_list)
nDepth = len(LAYERLIST)
nVar   = len(VARLIST)

BIAS    = np.zeros((nVar,nSub,nDepth), np.float32)
RMSE    = np.zeros((nVar,nSub,nDepth), np.float32)
NPOINTS = np.zeros((nVar,nSub,nDepth), np.int32)

TI =R.time_interval
M = Matchup_Manager(TI,INPUTDIR,BASEDIR)


for ivar, var in enumerate(VARLIST):
    print var
    for isub, sub in enumerate(OGS.NRT3):
        Profilelist = bio_float.FloatSelector(FLOATVARS[var], TI, sub)
        nProfiles = len(Profilelist)
        print sub.name, nProfiles
        Matchup_object_list=[]
        for ip in range(nProfiles):
            floatmatchup =  M.getMatchups([Profilelist[ip]], TheMask.zlevels, var, read_adjusted=read_adjusted[ivar])
            Matchup_object_list.append(floatmatchup)

        for ilayer, layer in enumerate(LAYERLIST):
            MODEL_LAYER_MEAN = [] # one value for each suitable profile in (subbasin, layer)