I am trying to use a data set of .nc4 files downloaded from NASA.
The format NCDF4 is confirmed by this source.
I used download .file in R to get the database and then a simple nc_open (ncdf4 package) to test the file. Unfortunately the result is an "Unknown file format" error.
Here my replication file and my script:
download.file (url=http://hydro1.gesdisc.eosdis.nasa.gov/.../url, destfile=destination_folder/file.nc4)
All fine till this point, but when testing the files:
library(ncdf4)
setwd('destination_folder')
data <- nc_open('file.nc4')
Error in R_nc4_open: NetCDF: Unknown file format
Error in nc_open("file.nc4") :
Error in nc_open trying to open file file.nc4
Am I missing something?
Thank you.
I do not know what is wrong, but I can add the information that the problem resides in the Windows implementation of the ncdf4 package. With the following statement:
catlg<-nc_open("http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/waterbase/concentration_of_suspended_matter_in_water/catalog.nc")
I have the same problem as described in the question. However, it works perfectly in R under Linux
The file server is an OpenDAP server strictly following netcdf 4 conventions, but maybe some features are not correctly implemented in the ncdf4 package under Windows
for some reason I get the same error using [64-bit] C:\Program Files\R\R-3.4.2), but when using [64-bit] C:\Program Files\R\R-3.3.3 the ncdf4 package works fine.
not that this solves the problem, but it provides an easy work around for the time being.
Related
I tried to load data to my R working directory and receive this error:
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘classize.RData’ has magic number 'RDX3'
Use of save versions prior to 2 is deprecated
I googled it and tried many options, unsuccessfully.
My Rstudio version is: 1.2.5033 (The error was happening before updating as well)
I create a new project, in the new directory, I put the data file
The data file is "classize.RData"
I have another alternative which is "classize.RDS" with the sugesstion to use readRDS(file = "classize.RDS"). When using this command, I receive that error:
cannot read workspace version 3 written by R 3.6.1; need R 3.5.0 or newer
This is in the context of a statistical course at university and my teacher assistant is unable to help me out, and whitout resolving this issue, I cannot move forward in the resolution of the needed exrecices. So please, couly you help me resolve that problem.
ps: all the students have access to the same data, It's just for me that it's not working, therefore the file should not be corrupted.
I have a problem with (I am using Windows 10) running library(tesseract) which shows Warning message:
Unable to find English training data.
I have downloaded "eng.traineddata" from https://github.com/tesseract-ocr/tessdata
While try to run
eng <- tesseract("eng")
It displays an error:
Error in tesseract_engine_internal(datapath, language, configs, opt_names, :
Unable to find training data for: eng. Please consult manual for: ?tesseract_download
You've probably used legacy, incompatible traineddata file. You'd need either tessdata_fast or tessdata_best data.
https://github.com/tesseract-ocr
With R4.1 I had to create the file "C:\Program Files (x86)\Tesseract-OCR" and add to it the eng.traineddata file downloaded from https://github.com/tesseract-ocr/tessdata_best/blob/main/eng.traineddata.
I am trying to download a set of NetCDF files from: ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/nwm/prod/nwm.20180425/medium_range/
When I manually download the files I have no issues connecting, but when I use download.file and attempt to connect I get the following error:
Assertion failed!
Program: C:\Program Files\Rstudio\bin\rsession.exe
File: nc4file.c, Line 2771
Expression: 0
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I have attempted to run the code in R without R studio and got the same result.
My abbreviated code is as followed:
library("ncdf4")
library("ncdf4.helpers")
download.file("ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/nwm/prod/nwm.20180425/medium_range/nwm.t00z.medium_range.channel_rt.f006.conus.nc","c:/users/nt/desktop/nwm.t00z.medium_range.channel_rt.f006.conus.nc")
temp = nc_open("c:/users/nt/desktop/nwm.t00z.medium_range.channel_rt.f006.conus.nc")
Adding mode = 'wb' to the download.file arguments solves the issue for me. I've had the same problem when downloading PDFs
download.file("ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/nwm/prod/nwm.20180425/medium_range/nwm.t00z.medium_range.channel_rt.f006.conus.nc","C:/teste/teste.nc", mode = 'wb')
I have been using roxygen2::roxygenise quite successfully with my package to build exported and imported functions. However, I recently ran into this error which I am unable to resolve:
> roxygen2::roxygenise()
First time using roxygen2. Upgrading automatically...
Error: File file does not exist
This is not the first time I have used roxygen2 with this package. In addition, I am not quite sure what "File file does not exist" means. Has anyone else seen this and been able to resolve it?
I think you have to set the working directory of R to be the package folder
I got the same error when using:
roxygen2::roxygenise("mypackage")
But, I didn't get the error when I instead used:
library(roxygen2)
roxygenise()
I know this is no explanation and I can't comment upon whether this works beyond my case.
I am struggeling with reading DICOM files in R. I have installed the oro.dicom package, using:
install.packages("oro.dicom", repos="https://cran.cnr.berkeley.edu/")
I have set the working directory to where the files are located.
When trying to read a dicom file, using...
slice=readDICOM("IM-0001-0011.dcm")
... I get the following error message:
Error: could not find function "readDICOM"
Can someone help?
Thank you,
Lena
You should load package with library(oro.dicom) fisrt before you will use functions from that package,