# Load netcdf format in Exploratory

**URL:** <https://community.exploratory.io/t/load-netcdf-format-in-exploratory/1936>\
**Category:** Uncategorized\
**Created:** [October 14, 2020, 4:58pm UTC](https://community.exploratory.io/t/load-netcdf-format-in-exploratory/1936 "2020-10-14T16:58:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdoulaye\_Sarr](https://community.exploratory.io/user_avatar/community.exploratory.io/abdoulaye_sarr/32/1041_2.png) [@Abdoulaye\_Sarr](https://community.exploratory.io/u/Abdoulaye_Sarr)\
**Post date:** [October 14, 2020, 4:58pm UTC](https://community.exploratory.io/t/load-netcdf-format-in-exploratory/1936/1 "2020-10-14T16:58:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Stephanie\_Brady](https://community.exploratory.io/user_avatar/community.exploratory.io/stephanie_brady/32/903_2.png) [@Stephanie\_Brady](https://community.exploratory.io/u/Stephanie_Brady)\
**Post date:** [January 28, 2022, 7:33pm UTC](https://community.exploratory.io/t/load-netcdf-format-in-exploratory/1936/2 "2022-01-28T19:33:46Z")

</div>

I am wondering how to do this as well. For my use case, we are using output from the National Water Model.

> [NOAA National Water Model CONUS Retrospective Dataset - Registry of Open Data on AWS](https://registry.opendata.aws/nwm-archive/)

For this example, I want to access the streamflow value for `feature_id` `1566054` from this file

[202001010000.CHRTOUT\_DOMAIN1.comp](https://noaa-nwm-retrospective-2-1-pds.s3.amazonaws.com/model_output/2020/202001010000.CHRTOUT_DOMAIN1.comp)

After changing the extension from `.comp` to `.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.

 ![image](https://community.exploratory.io/uploads/default/original/2X/4/43079003c96ccd5d4819e5c5ac097a9352df613b.png)

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.

Thanks.

Update:  
Using this [tutorial](https://pjbartlein.github.io/REarthSysSci/netCDF.html#reading-restructuring-and-writing-netcdf-files-in-r) 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](https://noaa-nwm-retrospective-2-1-pds.s3.amazonaws.com/index.html#model_output/2020/) and create a dataframe that contains the date/time stamp for the file (“202001010000” in this example) along with the streamflow.
