[R-sig-Geo] NetCDF: Unknown file format?

Ziyu Ma paul.ziyu.ma at gmail.com
Wed Jul 29 17:54:59 CEST 2015


Dear all,

I just found out the "raster" package actually handles NetCDF4 very nicely:
for example, NetCDF4 files can be converted to a raster simply by:

raster("FileName.nc", varname="SingleVariableToExtractInTheNetCDF4File")

I think it might be useful information to everybody so I repost it here.

Cheers,
Ma

Ziyu Ma
PhD Student
Ecoinformatics & Biodiversity,
Department of Bioscience, Aarhus University
Ny Munkegade 114, DK-8000 Aarhus C, Denmark


On Wed, Jul 29, 2015 at 3:22 PM, Ziyu Ma <paul.ziyu.ma at gmail.com> wrote:

> Thank you Mike,
>
> I see that there's probably no fast solution for this. And yes, there are
> lots of data. I will learn to work with it in Linux then.
>
> Cheers
> Ma
>
> Ziyu Ma
> PhD Student
> Ecoinformatics & Biodiversity,
> Department of Bioscience, Aarhus University
> Ny Munkegade 114, DK-8000 Aarhus C, Denmark
>
>
> On Wed, Jul 29, 2015 at 2:27 PM, Michael Sumner <mdsumner at gmail.com>
> wrote:
>
>>  Essentially this is probably that NetCDF4 (version 4 of the external
>> library) is required, but that neither ncdf or RNetCDF have been built with
>> that. The ncdf4 package is the only one that *requires* this, and CRAN
>> supports NetCDF-3 for Windows via ncdf and RNETCDF and doesn't support
>> ncdf4 for Windows.
>>
>> (There are many features in the NetCDF format, and there are many
>> features not supported by any of these packages whether version 4 or not.)
>>
>> You can get a build of ncdf4 for Windows here:
>>
>> http://cirrus.ucsd.edu/~pierce/ncdf/
>>
>> but you're on your own in terms of what version of R that will work in,
>> if at all, etc.
>>
>> You can  build one of the three packages yourself against NetCDF4 proper,
>> and that is my preference - it's easiest on Linux, but it's not exactly
>> "easy" if you are used to windows and the CRAN support for binary packages.
>>
>> If this is confusing that's just how it is - there are three R packages
>> for NetCDF, none of them support everything in NetCDF and what works best
>> depends on what you have available. If you have to do this a lot I
>> recommend learning to work in Linux.
>>
>> Cheers, Mike.
>>
>> On Wed, 29 Jul 2015 at 21:45 Ziyu Ma <paul.ziyu.ma at gmail.com> wrote:
>>
>>> Dear all,
>>>
>>> I tried to use R to open NetCDF file from the ESA's  soil moisture
>>> database:
>>> http://www.esa-soilmoisture-cci.org/node/145
>>>
>>> I have tried to use the R packages "ncdf" or "RNetCDF", but whenever I
>>> tried to open the file, I have this same error message:
>>>
>>> "Error in R_nc_open: NetCDF: Unknown file format"
>>>
>>> I'm confused since I think both packages where designed to handle this
>>> file
>>> format. Is there some other dependent softwares/packages missing on my
>>> computer? I'm running Windows 7 64 bit and R 3.2.0 64 bit.
>>>
>>> The soil moisture database recommends the "ncdf4" package, but the
>>> Windows
>>> version of it is no longer available.
>>>
>>> Thank you very much.
>>>
>>> Cheers,
>>> Ma
>>>
>>> Ziyu Ma
>>> PhD Student
>>> Ecoinformatics & Biodiversity,
>>> Department of Bioscience, Aarhus University
>>> Ny Munkegade 114, DK-8000 Aarhus C, Denmark
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list