Exemplo n.º 1
0
import sys
import matplotlib.pyplot as plt
import matplotlib.mlab as ml
import numpy as np
#from basemap import basemap_usgs
pydir='../'
sys.path.append(pydir)
from hx import getcodar_ctl_file_edge,getcodar_ctl_lalo,getcodar_ctl_id,getcodar_edge

###############################################
inputfilename='./getcodar_byrange_ctl.txt'
png_num=0 # for saving picture  
datetime_wanted,url,model_option,lat_max,lon_max,lat_min,lon_min,num,interval_dtime=getcodar_ctl_file_edge(inputfilename) # reads control file
for i in range(num): # loop through number of figures
  png_num=png_num+1 
  lat_max_i,lon_max_i,lat_min_i,lon_min_i=getcodar_ctl_lalo(model_option,lat_max,lon_max,lat_min,lon_min) # gets spatial index of box
  id=getcodar_ctl_id(model_option,url,datetime_wanted) # gets time index
  lat_vel,lon_vel,u,v=getcodar_edge(url,id,lat_max_i,lon_max_i,lat_min_i,lon_min_i) # gets actual values of lat, lon, U & V
  id=str(id)
  idg1=list(ml.find(np.array(u)<>-999.0/100.))   # index u values that are good
  idg2=list(ml.find(np.array(lat_vel)>=lat_min)) # index lats > lat_min
  idg12=list(set(idg1).intersection(set(idg2)))  # intersection of idg1 and idg2
  idg3=list(ml.find(np.array(lon_vel)>=lon_min)) # index lon > lon_min
  idg=list(set(idg12).intersection(set(idg3)))   # final intersection

  if len(idg)<>0:
    plt.title('') 
    plt.title(str(num2date(datetime_wanted).strftime("%d-%b-%Y %H"))+'h')
    pylab.ylim([lat_min-0.02,lat_max+0.02])
    pylab.xlim([lon_min-0.02,lon_max+0.02]) #enge
    q=plt.quiver(np.reshape(lon_vel,np.size(lon_vel))[idg],np.reshape(lat_vel,np.size(lat_vel))[idg],np.reshape(u,np.size(u))[idg],np.reshape(v,np.size(v))[idg],angles='xy',scale=3,color='b')
Exemplo n.º 2
0
if inputfilename[-2:]=='py':
  (datetime_wanted,filename,driftnumber,url,model_option,num,interval_dtime,interval,step_size)=getcodar_ctl_file_py()
else:
  (datetime_wanted,filename,driftnumber,url,model_option,num,interval_dtime,interval,step_size)=getcodar_ctl_file(inputfilename)
id3=int(driftnumber)  #change format for id
datetime_wanted_1=datetime_wanted
(maxlon,minlon,maxlat,minlat)=getdrift_raw_range_latlon(filename,id3,interval,datetime_wanted_1,num,step_size)
for i in range(5):  #make sure the picture can show lat and lon clearly
    if maxlat-minlat<=0.1:
        maxlat=maxlat+0.01
        minlat=minlat-0.01
    if maxlon-minlon<=0.1:
        maxlon=maxlon+0.01
        minlon=minlon-0.01

(lat_max_i,lon_max_i,lat_min_i,lon_min_i)=getcodar_ctl_lalo(model_option,maxlat,maxlon,minlat,minlon)# get index of max min lat lon
gbox=[minlon-0.03,maxlon+0.03, minlat-0.03, maxlat+0.03] # get edge for get sst
for x in range(num):
     
  id=getcodar_ctl_id(model_option,url,datetime_wanted) #get index of codar
  ask_input=num2date(datetime_wanted) #get time for getsst
  (drifter_data)=getdrift_raw(filename,id3,interval,datetime_wanted) #get drifter data
  lat=drifter_data['lat']
  lon=drifter_data['lon']
  (lat_vel,lon_vel,u,v)=getcodar_edge(url,id,lat_max_i,lon_max_i,lat_min_i,lon_min_i) #get codar data
  id=str(id)
  idg1=list(ml.find(np.array(u)<>-999.0/100.))
  idg2=list(ml.find(np.array(lat_vel)>=minlat))
  idg12=list(set(idg1).intersection(set(idg2)))
  idg3=list(ml.find(np.array(lon_vel)>=minlon))
  idg=list(set(idg12).intersection(set(idg3)))     #get index for codar data based on  edge and id(time)
Exemplo n.º 3
0
import matplotlib.mlab as ml
import numpy as np
#from basemap import basemap_usgs
pydir = '../'
sys.path.append(pydir)
from hx import getcodar_ctl_file_edge, getcodar_ctl_lalo, getcodar_ctl_id, getcodar_edge

###############################################
inputfilename = './getcodar_byrange_ctl.txt'
png_num = 0  # for saving picture
datetime_wanted, url, model_option, lat_max, lon_max, lat_min, lon_min, num, interval_dtime = getcodar_ctl_file_edge(
    inputfilename)  # reads control file
for i in range(num):  # loop through number of figures
    png_num = png_num + 1
    lat_max_i, lon_max_i, lat_min_i, lon_min_i = getcodar_ctl_lalo(
        model_option, lat_max, lon_max, lat_min,
        lon_min)  # gets spatial index of box
    id = getcodar_ctl_id(model_option, url, datetime_wanted)  # gets time index
    lat_vel, lon_vel, u, v = getcodar_edge(
        url, id, lat_max_i, lon_max_i, lat_min_i,
        lon_min_i)  # gets actual values of lat, lon, U & V
    id = str(id)
    idg1 = list(
        ml.find(np.array(u) <> -999.0 / 100.))  # index u values that are good
    idg2 = list(ml.find(np.array(lat_vel) >= lat_min))  # index lats > lat_min
    idg12 = list(set(idg1).intersection(
        set(idg2)))  # intersection of idg1 and idg2
    idg3 = list(ml.find(np.array(lon_vel) >= lon_min))  # index lon > lon_min
    idg = list(set(idg12).intersection(set(idg3)))  # final intersection

    if len(idg) <> 0:
Exemplo n.º 4
0
id3 = int(driftnumber)  #change format for id
datetime_wanted_1 = datetime_wanted
(maxlon, minlon, maxlat,
 minlat) = getdrift_raw_range_latlon(filename, id3, interval,
                                     datetime_wanted_1, num, step_size)
for i in range(5):  #make sure the picture can show lat and lon clearly
    if maxlat - minlat <= 0.1:
        maxlat = maxlat + 0.01
        minlat = minlat - 0.01
    if maxlon - minlon <= 0.1:
        maxlon = maxlon + 0.01
        minlon = minlon - 0.01

(lat_max_i, lon_max_i, lat_min_i,
 lon_min_i) = getcodar_ctl_lalo(model_option, maxlat, maxlon, minlat,
                                minlon)  # get index of max min lat lon
gbox = [minlon - 0.03, maxlon + 0.03, minlat - 0.03,
        maxlat + 0.03]  # get edge for get sst
for x in range(num):

    id = getcodar_ctl_id(model_option, url,
                         datetime_wanted)  #get index of codar
    ask_input = num2date(datetime_wanted)  #get time for getsst
    (lat, lon, time1) = getdrift_raw(filename, id3, interval,
                                     datetime_wanted)  #get drifter data
    (lat_vel, lon_vel, u, v) = getcodar_edge(url, id, lat_max_i, lon_max_i,
                                             lat_min_i,
                                             lon_min_i)  #get codar data
    id = str(id)
    idg1 = list(ml.find(np.array(u) <> -999.0 / 100.))
    idg2 = list(ml.find(np.array(lat_vel) >= minlat))
Exemplo n.º 5
0
import matplotlib.mlab as ml
import numpy as np
sys.path.append("/usr/local/lib/python2.7/dist-packages/Pydap-3.0.1-py2.7.egg")

import pytz
sys.path.append('../')
#from basemap import basemap_standard

from hx import getcodar_ctl_file_edge,getcodar_ctl_lalo,getcodar_ctl_id,getcodar_edge, plot_getsst

utc = pytz.timezone('UTC')
png_num=0 # for saving picture  
inputfilename='./getcodar_byrange_ctl.txt'
datetime_wanted,url,model_option,lat_max,lon_max,lat_min,lon_min,num,interval_dtime=getcodar_ctl_file_edge(inputfilename)  #get data from ctl file
gbox=[lon_min, lon_max, lat_min, lat_max]# 2012 ring , get edge box for sst
lat_max_i,lon_max_i,lat_min_i,lon_min_i=getcodar_ctl_lalo(model_option,lat_max,lon_max,lat_min,lon_min)
for i in range(num):
  png_num=png_num+1 
  
  id=getcodar_ctl_id(model_option,url,datetime_wanted)
  lat_vel,lon_vel,u,v=getcodar_edge(url,id,lat_max_i,lon_max_i,lat_min_i,lon_min_i) #get edge of codar

  id=str(id) # change id format
  idg1=list(ml.find(np.array(u)<>-999.0/100.))
  idg2=list(ml.find(np.array(lat_vel)>=lat_min))
  idg12=list(set(idg1).intersection(set(idg2)))
  idg3=list(ml.find(np.array(lon_vel)>=lon_min))
  idg=list(set(idg12).intersection(set(idg3)))   # get index of codar data

  if len(idg)<>0: