-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
In many scientific papers the authors separate between strong and weak beams (data observations) mainly because strong beams give better results (for specific scientific areas).
The OpenAltimetry API does not return the strong and weak beams for the ATL03 product (raw photons). For instance, the ATL08 product includes this information in the output .json file but not in the .csv file. However, this is not the case for the ATL03 product where neither the .json nor the .csv output file includes any information regarding the strong and weak beams.
I've included information regarding the beam pattern in the README.md file and I also sent an e-mail to the OpenAltimetry support (at 28th May 2022) and I'm waiting for the response. I've attached here a .zip file that includes two .RDS files,
- atl03_beams_strong_weak_JSON.RDS
- atl03_beams_strong_weak_CSV.RDS
The following code snippet allows to reproduce the two attached files
atl03_beams_strong_weak.zip
require(IceSat2R)
#...........................
# Sample dates for RGT cycle
#...........................
approx_date_start = "2021-02-01"
approx_date_end = "2021-02-15"
res_rgt_many = time_specific_orbits(date_from = approx_date_start,
date_to = approx_date_end,
RGT_cycle = NULL,
download_method = 'curl',
threads = parallel::detectCores(),
verbose = TRUE)
#.....................................................
# then we create the bounding box for a sample area
#.....................................................
plg = "POLYGON ((140 -6.641235, 145 -6.641235, 145 -1.641235, 140 -1.641235, 140 -6.641235))"
sf_obj_bbx = sf::st_as_sfc(plg, crs = 4326)
bbx_aoi = sf::st_bbox(obj = sf_obj_bbx)
# global grid of 1-degree
gl_grid_1_d = degrees_to_global_grid(minx = as.numeric(bbx_aoi['xmin']),
maxx = as.numeric(bbx_aoi['xmax']),
maxy = as.numeric(bbx_aoi['ymax']),
miny = as.numeric(bbx_aoi['ymin']),
degrees = 0.9,
verbose = TRUE)
res_inters = sf::st_intersects(x = gl_grid_1_d,
y = sf::st_geometry(res_rgt_many),
sparse = TRUE)
#.....................
# matched (RGT) tracks
#.....................
df_inters = data.frame(res_inters)
rgt_subs = res_rgt_many[df_inters$col.id, , drop = FALSE]
rgt_subs
#.............
# verify RGT's
#.............
dtbl_rgts = verify_RGTs(nsidc_rgts = rgt_subs,
bbx_aoi = bbx_aoi,
verbose = TRUE)
#........................................
# for-loop to iterate over the parameters
#........................................
dates_iters = unique(dtbl_rgts$Date_time)
RGTs_iters = unique(dtbl_rgts$RGT_NSIDC)
BEAMS = c( 'gt1l', 'gt1r', 'gt2l', 'gt2r', 'gt3l', 'gt3r')
dat_out_csv = dat_out_json = logs_out = list()
for (idx in seq_along(dates_iters)) {
date_i = dates_iters[idx]
rgt_i = RGTs_iters[idx]
for (beam_item in BEAMS) {
for (ROW_ID in df_inters$row.id) {
name_iter = glue::glue("{date_i}_{rgt_i}_{beam_item}_{ROW_ID}")
cat(glue::glue("Date: '{date_i}' RGT: '{rgt_i}' Beam: '{beam_item}' Global-Grid-ID: '{ROW_ID}'"), '\n')
bbx_gl_grid = gl_grid_1_d[ROW_ID, , drop = F]
bbx_gl_grid = sf::st_bbox(obj = bbx_gl_grid)
iter_dat = get_atlas_data(minx = as.numeric(bbx_gl_grid['xmin']),
miny = as.numeric(bbx_gl_grid['ymin']),
maxx = as.numeric(bbx_gl_grid['xmax']),
maxy = as.numeric(bbx_gl_grid['ymax']),
date = date_i,
trackId = rgt_i,
beamName = beam_item,
product = 'atl03',
client = 'portal',
outputFormat = 'csv',
verbose = FALSE)
iter_dat_json = get_atlas_data(minx = as.numeric(bbx_gl_grid['xmin']),
miny = as.numeric(bbx_gl_grid['ymin']),
maxx = as.numeric(bbx_gl_grid['xmax']),
maxy = as.numeric(bbx_gl_grid['ymax']),
date = date_i,
trackId = rgt_i,
beamName = beam_item,
product = 'atl03',
client = 'portal',
outputFormat = 'json',
verbose = FALSE)
iter_logs = list(Date = date_i,
RGT = rgt_i,
Beam = beam_item,
N_rows = nrow(iter_dat))
logs_out[[name_iter]] = data.table::setDT(iter_logs)
dat_out_csv[[name_iter]] = iter_dat
dat_out_json[[name_iter]] = iter_dat_json
}
}
}
dat_out_csv_df = data.table::rbindlist(dat_out_csv)
saveRDS(object = dat_out_csv_df, file = 'atl03_beams_strong_weak_CSV.RDS')
saveRDS(object = dat_out_json, file = 'atl03_beams_strong_weak_JSON.RDS')