I mostly work with climate data in netCDF format very common in the field. I wonder if someone in Exploratory has experience in importing this kind of format. I am new with the software but as Is uses R Think this should be possible with R packages handling netCDF.
I am wondering how to do this as well. For my use case, we are using output from the National Water Model.
For this example, I want to access the streamflow value for
1566054 from this file
After changing the extension from
.nc, I am able to use ArcGIS Pro (“Make NetCDF Table View” tool) to view the flows by
feature_ID, and select the corresponding record.
I have loaded the
ncdf4 R package into Exploratory. My goal is to create a time series for this
feature_id for the year 2020, which I assume means I would need to download 8,760 files and extract one record from each. I would welcome some advice as to how to proceed.
Using this tutorial my colleague and I were able to figure out how to grab that one value in R. This is what we have so far:
library(ncdf4) station_id <- 1566054 ncpath <- "C:/Users/sbrady/Downloads/" ncname <- "202001010000.CHRTOUT_DOMAIN1" ncfname <- paste(ncpath, ncname, ".nc", sep="") dname <- "streamflow" ncin <- nc_open(ncfname) stream_id <- ncvar_get(ncin,'feature_id') index <- which(stream_id %in% station_id) flow_array <- ncvar_get(ncin,dname) (flow_array[index])
So the next challenge is to figure out how to iterate through all the 2020
chrtout files on the AWS S3 Explorer and create a dataframe that contains the date/time stamp for the file (“202001010000” in this example) along with the streamflow.