Read a sub-set of NetCDF file in R - r

Is there a possibility to read a subset of a NetCDF file in R?
In Matlab, I can use
ncread(filename,'WS',[i_timeseries,j_timeseries,1,1],[1,1,1,48])
I am trying to extract a time series from the New European Wind Atlas using free software (preferably R) on Windows.
Many thanks indeed.

Related

How can I convert 6-hourly ERA-5 dataset to daily dataset in NetCDF file with R?

I have a 6-hourly snow depth dataset from 1980-2022 in the form of NetCDF. Is there anyone who has a suggestion or example code for converting 6-hourly to the daily dataset NetCDF file with R? I searched many times for this issue but there is no example (except for NCO, NCL, python, or MATLAB). But I wanna make this in a NetCDF file by R.

How to work with WorldClim data for MaxEnt

I am looking to extract WorldClim climate data for (current data and future projections) and convert the .geotif to .asc in order to run this through MaxEnt and create future climate change projections.
Problem 1: Worldclim gives me 1 .geotif from which I need to extract 19 separate variables, each as their own .geotif file.
Problem 2: Converting these .geotif files into .asc to run using MaxEnt.
I have access to free GIS software (QGIS/DIVA-GIS) and R, although I am fairly new to R. Any solutions would be really helpful, thank you.

Extracting data from NetCDF file

I'm working in R trying to use the data found here (https://datadryad.org/resource/doi:10.5061/dryad.dk1j0; two top files) to create a table similar to this: [administrative_name, GDP2010, GDP2011....., GDP 2015]
As far as i can see i need to extract the name of the administrative units from the "admin_areas_GDP_HDI.nc" file and combine them with the annual data in the GDP_per_capita_PPP_1990_2015.nc file.
With the ncdf4 package i've managed to open the archives, and to get all the attributes and variables, however I don't know how to access the data and extract it.
I've been trying to access the data all day, but i have limited experience with NetCDF archives, and have not managed to extract the data. Any pointers would help me out!
I like to use the raster package for dealing with NetCDF files. It uses the ncdf4 package to read in the files, but offers some additional tools for processing rasters. You did not mention what data you want to extract, so the example below shows the mean GDP for each administrative unit.
library(raster)
#Read in NetCDF files
ad -> brick('admin_areas_GDP_HDI.nc')
gdp -> brick('GDP_per_capita_PPP_1990_2015_v2.nc')
#Calculate mean GDP using admin zones
zoneMean -> zonal(gdp, ad[[1]], fun='mean', na.rm=T)

Transmit trades between Excel and R

Is there a way to make calls between R and Excel in order to run R quantstrat package using EOD data. Send proposed trades to an excel file (which has to be inserted manually as the broker does not have an API) and then import the trades from an excel file to R for continuous analysis? Thanks for your help

Is there an easy way I can open a data set of h5 files in R?

I recently downloaded a subset of the Million Song Data-set to use for some research. The collection of 10,000 observations is stored as 10,000 .h5 files, and I was wondering if there was a way to open and convert the data to a format that I could work with in R. Thanks for your help!
You should Google for a library to read HDF files.
It's a fairly standard format, I bet there is a module.

Resources