Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

Commit c4ca746

Browse files
committed
Moved key explanation to sep file.
1 parent b17209a commit c4ca746

File tree

2 files changed

+54
-49
lines changed

2 files changed

+54
-49
lines changed

README.md

+14-49
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ GribApi.NET is a C# wrapper around the [European Centre for Medium Range Weather
55

66
GRIB is a format commonly used in meteorology to store weather data. GribApi.NET makes it easy to encode and decode these data by providing access to both GRIB editions through a set of [GRIB API keys](https://software.ecmwf.int/wiki/display/GRIB/GRIB%20API%20keys). GribApi.NET and grib_api are licensed under the friendly [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
77

8+
## Docs
9+
The documentation is very much a WIP.
10+
[Example Key Dump](https://github.com/0x1mason/GribApi.NET/blob/master/docs/TypicalKeyDump.md)
11+
[Key Concepts](https://github.com/0x1mason/GribApi.NET/blob/master/docs/KeyConcepts.md)
12+
813
## Usage
9-
Add **Grib.Api.dll**, **Grib.Api.Native.dll**, and the **ext/grib_api/definitions** directory to your project. By default, GribApi.NET assumes the definitions are in the same directory as the library, but you can change the location by setting `Grib::Api::GribEnvironment::DefinitionsPath` or setting the `GRIB_DEFINITION_PATH` environment variable.
14+
Add **Grib.Api.dll**, **Grib.Api.Native.dll**, and the **ext/grib_api/definitions** directory to your project.
1015

1116
You're ready to go!
1217

1318
### Examples
14-
Getting grid information from a GRIB message:
19+
#### Getting grid information from a GRIB message:
1520
```csharp
1621
using (GribFile file = new GribFile("mygrib.grb"))
1722
{
@@ -31,7 +36,7 @@ Getting grid information from a GRIB message:
3136
}
3237
```
3338

34-
Iterating multiple messages:
39+
#### Iterating multiple messages:
3540
```csharp
3641
using (GribFile file = new GribFile("mygrib.grb"))
3742
{
@@ -42,7 +47,7 @@ Iterating multiple messages:
4247
}
4348
```
4449

45-
Iterating Lat/Lon/Value:
50+
#### Iterating Lat/Lon/Value:
4651
```csharp
4752

4853
GribMessage msg = gribFile.First();
@@ -55,7 +60,7 @@ Iterating Lat/Lon/Value:
5560
}
5661
```
5762

58-
Editing a single message and saving to a new file:
63+
#### Editing a single message and saving to a new file:
5964
```csharp
6065
string outPath = "out.grb";
6166
string readPath = "some.grb";
@@ -70,7 +75,7 @@ Editing a single message and saving to a new file:
7075
}
7176
```
7277

73-
Appending multiple messages to an existing file:
78+
#### Appending multiple messages to an existing file:
7479
```csharp
7580
using (GribFile readFile = new GribFile(readPath))
7681
{
@@ -89,12 +94,12 @@ The current build is only designed for Windows and Visual Studio. I am eager to
8994

9095
To build, you can use `build/Grib.Api.Master.sln`. The native projects are set to use the v110 (Visual Studio 2012) Cpp build tools. However, you can change these to match your version of VS in the native projects' `Properties > General > Platform Toolset` field.
9196

92-
To run a full release build and package, you'll need `NUnit` and `Nuget` on PATH. Then run:
97+
To run a full release build, you'll need `NUnit` and `Nuget` on PATH. Then run:
9398
```shell
9499
build/build_gribapi.cmd [build|rebuild] [VS version, 11|12|14]
95100
```
96101

97-
E.g., to build for with Visual Studio 2012 (VS version 11):
102+
E.g., to build with Visual Studio 2012 (VS version 11):
98103
```shell
99104
build/build_gribapi.cmd build 11
100105
```
@@ -111,44 +116,4 @@ build/run_tests x64 Debug
111116
or
112117
```shell
113118
build/run_tests x86 Debug 1
114-
```
115-
116-
## Concepts
117-
118-
### GRIB API Keys
119-
GribApi.NET treats GRIB messages as a collection of key-value pairs.
120-
121-
### Types of Keys
122-
#### Coded and Computed Keys
123-
There are two different types of keys: coded and computed. The coded keys are obtained by directly decoding the GRIB file octets. The key names derive from the official WMO documentation on the GRIB 1 and 2 standards. Spaces are removed from the the key description and the words are "camel cased". E.g., the caption `identification of originating generating centre` is transformed to `identificationOfOriginatingGeneratingCentre`. Some aliases are also available. You can find the captions for [most data representations on the WMO's site](http://www.wmo.int/pages/prog/www/WMOCodes/WMO306_vI2/LatestVERSION/LatestVERSION.html).
124-
125-
The computed keys are obtained by combining other keys (coded or computed). When their value is set all related keys are updated in a cascade process. These keys synthesize information contained in the GRIB message and are a safe way to set complex attributes such as the type of grid or the type of packing. They also help interpret octets such as the scanning mode whose bits are related to the way of scanning the grid. In this case the computed keys:
126-
```
127-
iScansNegatively
128-
jScansPositively
129-
jPointsAreConsecutive
130-
alternativeRowScanning (available only for edition 2)
131-
```
132-
will provide access to single bits of the scanning mode octect hiding its structure from the user.
133-
134-
#### Read-Only Keys
135-
The keys can also have some attributes as read only, which means that the key cannot be set (e.g. 7777 at the end of the message), or edition specific that is the attribute of all the keys having different values in the two editions (e.g. longitudeOfFirstGridPoint) or being present in one edition only (e.g. alternativeRowScanning).
136-
137-
#### Function Keys
138-
There are some computed keys that cannot be "get" and can be considered as functions acting on the grib in some way. These keys are always characterised by a predicate in their name (e.g. setDecimalPrecision).
139-
140-
#### InDegrees
141-
All the angle variables are provided in two versions, a native one with the units coded into the GRIB file and an edition independent one in degrees. It is always better to work with the "in degrees" version that is always provided through the key which has the same name of the native version with the suffix InDegrees
142-
```
143-
longitudeOfFirstGridPoint -> longitudeOfFirstGridPointInDegrees
144-
latitudeOfFirstGridPoint -> latitudeOfFirstGridPointInDegrees
145-
longitudeOfLastGridPoint -> longitudeOfLastGridPointInDegrees
146-
latitudeOfFirstGridPoint -> latitudeOfLastGridPointInDegrees
147-
latitudeOfFirstGridPoint -> latitudeOfFirstGridPointInDegrees
148-
iDirectionIncrement -> iDirectionIncrementInDegrees
149-
jDirectionIncrement -> jDirectionIncrementInDegrees
150-
```
151-
152-
**You do not need to use the suffix "InDegrees" explicitly in GribApi.NET. The library converts key values to degrees by default, though you can disable this functionality.**
153-
154-
You can read more about GRIB API Keys [here](https://software.ecmwf.int/wiki/display/GRIB/GRIB%20API%20keys).
119+
```

docs/KeyConcepts.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Key Concepts
2+
(shameless pun is absolutely intended)
3+
4+
## GRIB API Keys
5+
GribApi.NET treats GRIB messages as a collection of key-value pairs.
6+
7+
### Types of Keys
8+
#### Coded and Computed Keys
9+
There are two different types of keys: coded and computed. The coded keys are obtained by directly decoding the GRIB file octets. The key names derive from the official WMO documentation on the GRIB 1 and 2 standards. Spaces are removed from the the key description and the words are "camel cased". E.g., the caption `identification of originating generating centre` is transformed to `identificationOfOriginatingGeneratingCentre`. Some aliases are also available. You can find the captions for [most data representations on the WMO's site](http://www.wmo.int/pages/prog/www/WMOCodes/WMO306_vI2/LatestVERSION/LatestVERSION.html).
10+
11+
The computed keys are obtained by combining other keys (coded or computed). When their value is set all related keys are updated in a cascade process. These keys synthesize information contained in the GRIB message and are a safe way to set complex attributes such as the type of grid or the type of packing. They also help interpret octets such as the scanning mode whose bits are related to the way of scanning the grid. In this case the computed keys:
12+
```
13+
iScansNegatively
14+
jScansPositively
15+
jPointsAreConsecutive
16+
alternativeRowScanning (available only for edition 2)
17+
```
18+
will provide access to single bits of the scanning mode octect hiding its structure from the user.
19+
20+
#### Read-Only Keys
21+
The keys can also have some attributes as read only, which means that the key cannot be set (e.g. 7777 at the end of the message), or edition specific that is the attribute of all the keys having different values in the two editions (e.g. longitudeOfFirstGridPoint) or being present in one edition only (e.g. alternativeRowScanning).
22+
23+
#### Function Keys
24+
There are some computed keys that cannot be "get" and can be considered as functions acting on the grib in some way. These keys are always characterised by a predicate in their name (e.g. setDecimalPrecision).
25+
26+
#### InDegrees
27+
All the angle variables are provided in two versions, a native one with the units coded into the GRIB file and an edition independent one in degrees. It is always better to work with the "in degrees" version that is always provided through the key which has the same name of the native version with the suffix InDegrees
28+
```
29+
longitudeOfFirstGridPoint -> longitudeOfFirstGridPointInDegrees
30+
latitudeOfFirstGridPoint -> latitudeOfFirstGridPointInDegrees
31+
longitudeOfLastGridPoint -> longitudeOfLastGridPointInDegrees
32+
latitudeOfFirstGridPoint -> latitudeOfLastGridPointInDegrees
33+
latitudeOfFirstGridPoint -> latitudeOfFirstGridPointInDegrees
34+
iDirectionIncrement -> iDirectionIncrementInDegrees
35+
jDirectionIncrement -> jDirectionIncrementInDegrees
36+
```
37+
38+
**You do not need to use the suffix "InDegrees" explicitly in GribApi.NET. The library converts key values to degrees by default, though you can disable this functionality.**
39+
40+
You can read more about GRIB API Keys [here](https://software.ecmwf.int/wiki/display/GRIB/GRIB%20API%20keys).

0 commit comments

Comments
 (0)