Giter Site home page Giter Site logo

ncdf4's Introduction

Travis build status

ncdf4

The goal of ncdf4 is to provide an "Interface to Unidata netCDF (Version 4 or Earlier) Format Data Files".

This fork of the CRAN package ncdf4 is intended to update the Windows build process, and specifically to add support for Thredds.

Alternatives:

Todo

  • check Makevars.win (assume can remove "DHAVE_LIBUDUNITS2" but what about "-DHAVE_DECL_NC_RENAME_GRP=1"?)
  • add tests, especially for Thredds (make sure 32-bit Windows limitation is understood)
  • roxygenize?

Installation

You can install the released version of ncdf4 from CRAN with:

install.packages("ncdf4")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("mdsumner/ncdf4")

Example

Read from Thredds (will only work in Windows 64-bit, not 32-bit).

u <- "http://coastwatch.pfeg.noaa.gov/erddap/griddap/erdQSwind3day"
nc <- ncdf4::nc_open(u)
class(nc)
#> [1] "ncdf4"
## note that "ncdf" argument is required to trigger use of ncdf4
r <- raster::raster(u, ncdf = TRUE, varname = "x_wind")
print(r)
#> class       : RasterLayer 
#> band        : 1  (of  3774  bands)
#> dimensions  : 1201, 2881, 3460081  (nrow, ncol, ncell)
#> resolution  : 0.125, 0.125  (x, y)
#> extent      : -0.0625, 360.0625, -75.0625, 75.0625  (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
#> data source : http://coastwatch.pfeg.noaa.gov/erddap/griddap/erdQSwind3day 
#> names       : Zonal.Wind 
#> z-value     : 932644800 
#> zvar        : x_wind 
#> level       : 1

ncdf4's People

Contributors

mdsumner avatar davidwpierce avatar

Stargazers

Barbara Robson avatar Christophe Dervieux avatar  avatar

Watchers

 avatar

Forkers

dlebauer

ncdf4's Issues

Issue with nc_open on Windows

Hi @mdsumner , this code fails on Windows

ncdf4::nc_open("https://www.ncei.noaa.gov/thredds/dodsC/ncFC/fc-oisst-daily-avhrr-only-dly/OISST_Daily_AVHRR-only_Feature_Collection_best.ncd")

Error in R_nc4_open: NetCDF: Invalid argument

The same code goes well on linux;

Any idea how to solve that?

Different time dimension reads across ncdf4 vs. xarray & panoply

Hesitant to raise this issue because it felt above my head to diagnose, but here is a synopsis of deeper issue of an original question raised here on stackoverflow.

Original question was how to convert dates of a netcdf file, read into R using ncdf4::nc_open() that had units of "minutes since 1850-01-16T14:06:00"

Through exploring answers to the question we noticed that we could answer the original question of how to convert the dates, but the outputs never aligned with the expected results, which we knew from opening the same file in {xarray} and panoply. With the ultimate solution resulting in multiplying the time dimension by sixty before converting to datetime (which is counterintuitive to the netcdf units) and then correcting the alignment of the day.

I guess the larger question is whether anyone else has encountered this mismatch of time/attributes across packages.

Happy to provide more context if there is an avenue to diagnosing the issue. Also understand if this is an edge case where the juice is not worth the squeeze. Appreciate the work you do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.