Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Alexander-Barth/NCDatasets.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed May 25, 2018
2 parents d8b218b + f805292 commit 07eddfb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
[![documentation latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://alexander-barth.github.io/NCDatasets.jl/latest/)


`NCDatasets` allows one to read and create NetCDF files.
`NCDatasets` allows one to read and create netCDF files.
NetCDF data set and attribute list behave like Julia dictionaries and variables like Julia arrays.


The module `NCDatasets` provides support for the following [netCDF CF conventions](http://cfconventions.org/):
* `_FillValue` will be returned as `missing` (DataArrays)
* `scale_factor` and `add_offset` are applied
* `_FillValue` will be returned as `missing` (DataArrays),
* `scale_factor` and `add_offset` are applied,
* time variables (recognized by the `units` attribute) are returned as `DateTime` objects.

The raw data can also be accessed (without the transformations above).
Expand Down Expand Up @@ -51,7 +51,7 @@ using NCDatasets
ds = Dataset("file.nc")
```

The following displays the information just for the variable `varname` and the global attributes:
The following displays the information just for the variable `varname` and for the global attributes:

```julia
ds["varname"]
Expand Down Expand Up @@ -213,15 +213,28 @@ units = get(v,"units","adimensional")
close(ds)
```

## Get one or several variables by specifying the value of an attribute

The variable name are not always standardized, for example the longitude we can
find: `lon`, `LON`, `longitude`, ...

The solution implemented in the function `varbyattrib` consists in searching for the
variables that have specified value for a given attribute.

```julia
lon = varbyattrib(ds, standard_name="longitude");
```
will return the list of variables of the dataset `ds` that have "longitude"
as standard name.

# Filing an issue

When you file an issue, please include sufficient information that would _allow somebody else to reproduce the issue_, in particular:
1. Provide the code that reproduces the issue
2. If necessary to run your code, provide the used netCDF file(s)
1. Provide the code that generates the issue.
2. If necessary to run your code, provide the used netCDF file(s).
3. Make your code and netCDF file(s) as simple as possible (while still showing the error and being runnable). A big thank you for the 5-star-premium-gold users who do not forget this point! 👍🏅🏆
4. The full error message that you are seeing (in particular file names and line numbers of the stack-trace)
5. Which version of Julia and NCDatasets are you using? Please include the output of:
4. The full error message that you are seeing (in particular file names and line numbers of the stack-trace).
5. Which version of Julia and `NCDatasets` are you using? Please include the output of:
```
versioninfo()
Pkg.installed()["NCDatasets"]
Expand Down
18 changes: 9 additions & 9 deletions src/NCDatasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,16 @@ end
Create a new NetCDF file if the `mode` is "c". An existing file with the same
name will be overwritten. If `mode` is "a", then an existing file is open into
append mode (i.e. existing data in the NetCDF file is not overwritten and
a variabale can be added). With the mode equal to "r", an existing NetCDF file or
append mode (i.e. existing data in the netCDF file is not overwritten and
a variable can be added). With the mode set to "r", an existing netCDF file or
OPeNDAP URL can be open in read-only mode. The default mode is "r".
# Supported formats:
* :netcdf4 (default): HDF5-based NetCDF format
* :netcdf4_classic: Only netCDF 3 compatible API features will be used
* :netcdf3_classic: classic NetCDF format supporting only files smaller than 2GB.
* :netcdf3_64bit_offset: improved NetCDF format supporting files larger than 2GB.
* :netcdf4 (default): HDF5-based NetCDF format.
* :netcdf4_classic: Only netCDF 3 compatible API features will be used.
* :netcdf3_classic: classic netCDF format supporting only files smaller than 2GB.
* :netcdf3_64bit_offset: improved netCDF format supporting files larger than 2GB.
Files can also be open and automatically closed with a `do` block.
Expand Down Expand Up @@ -469,7 +469,7 @@ end
"""
defDim(ds::Dataset,name,len)
Define a dimension in the data-set `ds` with the given `name` and length `len`.
Define a dimension in the data set `ds` with the given `name` and length `len`.
If `len` is the special value `Inf`, then the dimension is considered as
`unlimited`, i.e. it will grow as data is added to the NetCDF file.
Expand Down Expand Up @@ -1210,7 +1210,7 @@ Base.in(name::AbstractString,a::NCIterable) = name in keys(a)
start(d::NCDatasets.Dimensions)
start(g::NCDatasets.Groups)
Allow to iterate over a dataset, attribute list, dimensions and NetCDF groups.
Allow one to iterate over a dataset, attribute list, dimensions and NetCDF groups.
```julia
for (varname,var) in ds
Expand Down Expand Up @@ -1294,7 +1294,7 @@ end
Generate the Julia code that would produce a NetCDF file with the same metadata
as the NetCDF file `fname`. The code is placed in the file `jlname` or printed
to the standard output. Per default the new NetCDF file is called `filename.nc`.
to the standard output. By default the new NetCDF file is called `filename.nc`.
This can be changed with the optional parameter `newfname`.
"""

Expand Down

0 comments on commit 07eddfb

Please sign in to comment.