Esempio n. 1
0
def getprofile(time,lon,lat):
    lon = float(lon)
    lat = float(lat)
    R=Rectangle(lon,lon,lat,lat)
    Profilelist=bio_float.FloatSelector(None,TimeInterval.fromdatetimes(time, time),R)
    profile=Profilelist[0]
    return profile
Esempio n. 2
0
def MooringSelector(var, T, region):

    LOC      = "/gss/gss_work/DRES_OGS_BiGe/Observations/TIME_RAW_DATA/ONLINE/COPERNICUS/mooring/"

    INTEREST_VARLIST=['PHOS','SLCA','CPHL','NTRA','PHPH','DOX1']
    ALLVARLIST=['PHOS','SLCA','AMON','DOX1','DOX2','CPHL','NTRZ','NTRA','NTRI','PHPH']
    A = INDEX_FILE

    nFiles=A.size
    selected = []
    for i in range(nFiles):
        filename=os.path.basename(A['file_name'][i])
        parameters = A['parameters'][i]
        ti = TimeInterval(A[i]['time_coverage_start'],A[i]['time_coverage_end'],'%Y-%m-%dT%H:%M:%S' )
        lon = A[i]['geospatial_lon_min']
        lat = A[i]['geospatial_lat_min']

        if var is None:
            VarCondition = False
            for thevar in ALLVARLIST:
                if thevar in parameters: VarCondition = True
        else:
            VarCondition = var in parameters

        Filecondition = VarCondition & (filename[:2]=='MO') & ("mooring" in A['file_name'][i])
        
        if Filecondition & (ti.isInWindow(T)) & region.is_inside(lon, lat):
            filepath =  LOC + os.path.basename(A[i]['file_name'])
            ncIN = NC.netcdf_file(filepath,'r')
            timesInFile = ncIN.variables['TIME'].data.copy() # days since 1950-01-01T00:00:00Z
            ncIN.close()

            available_params = A['parameters'][i]
            M = Mooring(lon,lat,filepath,available_params)
            for t in timesInFile:
                dateprofile = basetime + datetime.timedelta(days = t)
                if T.contains(dateprofile):
                    mp = MooringProfile(dateprofile,lon,lat,M,available_params)
                    selected.append(mp)
    return selected
Esempio n. 3
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)