I want to import he5 irradiance files from giovanni. See a list here.
This post shows how to import he5 files into QGIS, but I'd like to import them into R. Is it possible? I tried package rhdf5
but couldn't find how to do it.
-
what have you tried, and what didn't work for you, please edit your answer using the edit link, to include this sort of information. I tried your example link, but it needs some sort of authentication, so that's not particularly useful, can you suplly a link to another sample– nmtokenCommented Nov 26, 2016 at 16:56
-
I wrote a link to the list of irradiance files now. Must register to download them.– Santi XGRCommented Nov 28, 2016 at 8:42
Add a comment
|
1 Answer
You need to use two packages, raster
and ncdf4
. The first one will let you open raster file; the second one, to assign ncdf4
space into raster package and view metadata. Important: is necessary to select Data field, you can't open all Data field at the same time (or at less I don't know how to do it without a for
or do.call
function). An example with the file that you give us:
library(raster)
library(ncdf4)
# View Data fields
nc_open("/path/to/OMI-Aura_L3-OMUVBd_2004m1001_v003-2016m0525t164359.he5")
File /path/to/OMI-Aura_L3-OMUVBd_2004m1001_v003-2016m0525t164359.he5 (NC_FORMAT_NETCDF4):
19 variables (excluding dimension variables):
float Data Fields/CSErythemalDailyDose[Data Fields/phony_dim_1,Data Fields/phony_dim_0] (Chunking: [90,23]) (Compression: level 5)
MissingValue: -1.26765060022823e+30
Offset: 0
ScaleFactor: 1
_FillValue: -1.26765060022823e+30
Title: Clear Sky Erythemal Daily Dose
UniqueFieldDefinition: OMI-Specific
Units: J/m2
.
.
.
# Open Data field as raster
r <- raster("/path/to/OMI-Aura_L3-OMUVBd_2004m1001_v003-2016m0525t164359.he5",
var="Data Fields/CSIrradiance324",ncdf=TRUE)
plot(r)