Web Content Display

Web Content Display (CoastWatch User Forum)

The NOAA CoastWatch Forum provides information in several categories.  The information is relevant to CoastWatch products and software (https://coastwatch.noaa.gov)  and vary in technical details.  For questions and issues not addressed here,  start a thread in the appropriate category or contact the CoastWatch HelpDesk (coastwatch.info@noaa.gov).  Please note our Privacy Policy (https://www.noaa.gov/privacy.html) and that this is a public forum.  All information is voluntarily and anonymous submissions are accepted pending review prior to posting. 

Forums

Back

RE: .nc fails to open in R

U
Anonymous, modified 3 Years ago.

.nc fails to open in R

I followed your code in R. The file downloaded fine, but

```nc <- ncdf4::nc_open("myDataFile.nc")``` creates the following errors
Error in R_nc4_open: Invalid argument
Error in ncdf4::nc_open("myDataFile.nc") : 
  Error in nc_open trying to open file myDataFile.nc

r .nc
MA
Melanie Abecassis, modified 3 Years ago.

RE: .nc fails to open in R

Youngling Posts: 65 Join Date: 6/12/17 Recent Posts

Hi,

Try this:

This worked for me in Windows (you need to install the 'httr' library if you don't have it already):

library(httr)
junk <- GET(erddap_url, write_disk("myDataFile.nc", overwrite=TRUE))

And then: nc=nc_open("myDataFile.nc")

U
Anonymous, modified 3 Years ago.

RE: .nc fails to open in R

Star! Works perfectly. Thanks very much.

MA
Melanie Abecassis, modified 3 Years ago.

RE: .nc fails to open in R

Youngling Posts: 65 Join Date: 6/12/17 Recent Posts

Great!!

Reply to Main Thread
Quick Reply