Reputation: 1
I'm struggling to deal with sentinel-3 data in R, of 300 meters resolution. I would like to extract TSM (Total Suspended Matter concentration) in each cell. Data are provided in a archive, with many different netcdf files (for example, one for coordinates, another one for chlorophyl, etc). Please, find the data here.
I tried this approach:
library(stars)
nc_files <- c("S3B_OL_2_WFR____20230218T101125_20230218T101425_20230219T222151_0179_076_179_2160_MAR_O_NT_003.SEN3/geo_coordinates.nc", "S3B_OL_2_WFR____20230218T101125_20230218T101425_20230219T222151_0179_076_179_2160_MAR_O_NT_003.SEN3/tsm_nn.nc")
lon_lat_tsm <- read_stars(nc_files)
It gives
> lon_lat_tsm
stars object with 2 dimensions and 5 attributes
attribute(s), summary of first 1e+05 cells:
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
altitude [m] 0.000000 46.000000 330.0000000 438.93277000 889.0000000 1508.000000 0
latitude [°] 39.568894 40.402587 41.0897840 40.99148193 41.6207120 42.046713 0
longitude [°] -7.581946 -3.745773 0.0337230 0.05383067 3.8784562 7.686906 0
TSM_NN -1.909408 -1.148438 -0.9310176 -0.84433249 -0.5505323 2.438995 56460
TSM_NN_err -2.000000 -1.963763 -1.8369349 -1.72683826 -1.5832780 1.986036 56460
dimension(s):
from to offset delta refsys point values x/y
x 1 4865 0 1 NA NA NULL [x]
y 1 4091 4091 -1 NA NA NULL [y]
Longitude and latitude are in the attributes of the stars object, and there is no assigned projection.
If i try to plot: moutains above are supposed to be the Pyreneans, and those at the middle left are the Alps (so the true south is north in the plot, and the true west is east in the plot). The bounding box is not correct, but it's not surprising since there is no projection, and the orientation is not good.
I think my major issue is that the geo_coordinates file is not recognized as the reference coordinates for the tsm_nn.nc file.
I'm a bit confused with these data, any help would be appreciate!
Thank you!
Upvotes: 0
Views: 255
Reputation: 4121
lon_lat_tsm
contains the matrices with longitudes and latitude for every grid cell. You can read one of the other variables and set the geolocation arrays (lon lat matrices) with e.g.
r = read_stars("S3B_OL_2_WFR____20230218T101125_20230218T101425_20230219T222151_0179_076_179_2160_MAR_O_NT_003.SEN3/Oa01_reflectance.nc",
curvilinear = list(x = lon_lat_tsm$geo_coordinates.nc.longitude, y = lon_lat_tsm$geo_coordinates.nc.latitude))
Then you can plot e.g. with
plot(r, axes = TRUE, downsample = 10, reset = FALSE)
maps::map(add = TRUE)
Upvotes: 1