-
Notifications
You must be signed in to change notification settings - Fork 3
/
get_lon_lat_time.R
68 lines (51 loc) · 1.73 KB
/
get_lon_lat_time.R
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
get_lon_lat_time=function(float_ids, float_profs=NULL){
# DESCRIPTION:
# This function loads longitude, latitude, and time information
# for the specified floats (and their specified profiles, if given).
#
# INPUT:
# float_ids: WMO ID(s) of one or more floats
#
# OPTIONAL INPUT:
# float_profs : float profile is an array with the per-float indices
# as returned by function "select_profiles";
#
# OUTPUTS:
# lon : cell array with longitude values for all specified floats
# lat : cell array with latitude values for all specified floats
# time : cell array with time values for all specified floats (in
# datenum format)
#
#
# AUTHORS:
# Marin Cornec (NOAA-PMEL), Yibin Huang (NOAA-PMEL),
# Quentin Jutard (OSU ECCE TERRA), Raphaelle Sauzede (IMEV) and
# Catherine Schmechtig (OSU ECCE TERRA).
#
# CITATION:
# M. Cornec, Y. Huang, Q. Jutard, R. Sauzede, and C. Schmechtig, 2022.
# OneArgo-R: An R toolbox for accessing and visualizing Argo data.
# Zenodo. https://doi.org/10.5281/zenodo.6604650
#
# LICENSE: oneargo_r_license.m
#
# DATE: JUNE 1, 2022 (Version 1.0.1)
lon=NULL
lat=NULL
time=NULL
if(is.null(float_ids)){
stop("no floats specified")
}
Data = load_float_data(float_ids=float_ids,float_profs=float_profs)$Data
nfloats = length(Data)
fnames = names(Data)
for (f in 1:nfloats){
lon[[f]]<-Data[[fnames[f]]]$LONGITUDE[1,]
names(lon)[f] <- names(Data[f]) #
lat[[f]]<-Data[[fnames[f]]]$LATITUDE[1,]
names(lat)[f] <- names(Data[f]) #
time[[f]]<-Data[[fnames[f]]]$TIME[1,]
names( time)[f] <- names(Data[f]) #
}
return(list(lon=lon,lat=lat,time=time))
}