Git Product home page Git Product logo

fimex's Introduction

Fimex

Fimex is a library and a program to convert gridded geospatial data between different formats and projections.

Dependencies

Fimex requires at least the following libraries to be installed for compilation

  • c99/c++ compiler
  • libxml2 >= 2.6.0
  • boost library
    • tested with 1.48, 1.54, 1.58, and a few other versions
  • proj-4 >= 4.4.9
  • udunits2 (>= 2.1.9)

To configure the different file formats it requires:

  • NetCDF (netcdf > 3.5)
  • Grib_API (grib_api > 1.4) or ecCodes

To build the python interface, it requires:

  • python development files (>= 3.4)
  • python numpy development files

Installation

Since version 0.64.0~rc1, fimex is built with cmake. The minimum required cmake version is 2.8.12.

These commands illustrate how fimex might be compiled:

SRC=/fimex/source
BLD=/fimex/build
INS=/fimex/install

GENERATOR="Unix Makefiles" # unix
GENERATOR="CodeBlocks - $GENERATOR" # for qtcreator and others
#GENERATOR="Eclipse CDT4 - $GENERATOR" # for eclipse

mkdir $BLD
cd $BLD
cmake -G"$GENERATOR" \
    -DBUILD_SHARED_LIBS=ON \
    -DENABLE_GRIBAPI=YES -Dgrib_api_DIR=/path/to/grib_api \
    -DENABLE_THIS=YES \
    -DENABLE_THAT=NO \
    -DCMAKE_INSTALL_PREFIX="$INS" \
    "$SRC"

make all test install

Of course, ENABLE_THIS and ENABLE_THAT should be replaced with actual config options.

There are several ways to edit available config options

  1. read the top-level CMakeLists.txt and pass values to cmake via -D...
  2. run cmake without options, then use either
    • ccmake, a text-based configuration editor, or
    • cmake-gui a Qt-based configuration editor, or
    • some IDE editor (e.g. qtcreator)

Please note that some packages are searched via pkg-config and that it might be necessary to have PKG_CONFIG_PATH set properly if packages are installed in non-standard locations or if you wrote your own .pc files.

It is recommended to build fimex outside the source directory, ie BLD != SRC in the above example.

Since Fimex makes some floating-point calculations in large loops, it is advisable to switch on SIMD/SSE operations in your compiler. On a Xeon machine with a x386 CPU and gcc, the following flags might help (those are default for x86-64)

CFLAGS='-O2 -mfpmath=sse -msse2' CXXFLAGS='-O2 -mfpmath=sse -msse2' cmake ...

Testing the Installation

Some tests require download of test-data which must be uncompressed and added to the fimex-source/test directory. Then run make -C /fimex/build test. Following the above example, command like these might be used

curl https://wiki.met.no/_media/fimex/flth00.dat.gz | gunzip > $SRC/test/flth00.dat
make -C $BLD  test

Usage Example

Converting a model output from felt to NetCDF:

  1. Get an overview of times, layers and grid used in the felt-file.

  2. Group the parameters so that all parameters within an group use the same grid, times and the same layers (its possible to have a file with both sigma and pressure layers, but then all sigma-variables should have the same number of sigma layers and all pressure-variables should have the same number of pressure layers. Surface only variables, usually sigma=1000 felt variables, are a layer-group of their own).

  3. Create a felt2nc_variables.xml file for each variable group. Copy parameters from existing examples, or lookup variable and parameter names in the CF standard name documentation. If you have to generate several groups, it might be useful to split the file into axes, global attributes and variables, see, e.g., damocles_felt2nc_variables.xml. If you have two parameters which map to the same standard_name, make sure to give them different variable names if they are in the same group Adjust the datatype according to your data. float will always work fine, use short if you know that the variable even fits as 4-dimensional data into shorts. Use eventually a cdmWriterConfig.xml to process data as float and write the data as short.

  4. Validate the felt2nc_variables.xml file with, e.g.,

    xmllint --xinclude --postvalid --noout ../../share/etc/felt2nc_variables.xml
    
  5. Adjust the projection and area you want to extract in fimex_example.cfg (or use command line arguments to fimex)

  6. Run

    fimex -c fimex_example.cfg
    

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.