Version 6 (modified by nvuilsce, 11 years ago) (diff)



FLUXNET_DATA is a set of Python scripts that aim at generating meteorological ORCHIDEE input file (.nc file) from FLUXNET site data (.csv file).
Additionally, the file stores other monitored variables that may serve for model/data comparison.
The main feature of FLUXNET_DATA is to fill the gaps in the meteorological time series thanks to ERA-interim 3-hourly product.

Input requirements

FLUXNET_DATA scripts will read two .txt files named siteinfo.txt and configinfo.txt.


siteinfo.txt lists the different FLUXNET sites for which we want to generate ORCHIDEE input files. For each site, siteinfo.txt gives site ID, first and last years for which data are available, latitude and longitude of the site location, and optionally shift to UTC time (in hour).
siteinfo.txt looks like:

Site    FirstY  LastY	Lat	     Lon	  UTCtime(optional)
RU-Zot	2002	2004	60.80080032  89.35079956
NL-Loo  1996    2006    52.16790009  5.743959904 

This siteinfo.txt refers to files named RU-Zot.XXXX.synth.hourly.allvars.csv and NL-Loo.YYYY.synth.hourly.allvars.csv with XXXX from 2002 to 2004 and YYYY from 1996 to 2006.


configinfo.txt gives four information: the location of the .csv files (name_path_weather) the location of the ERA-interim products (name_path_reanalysis) the directory where we want to store the ORCHIDEE input files (name_path_out) the shortest gap for which we use the reanalysis for filling gaps (gapmax). Below gapmax length, we use a linear interpolation . It is expressed in time step of the in-situ data and its default value is 6 (= 3 hours)


FLUXNET_DATA creates half-hourly time-series of Air Temperature, Rainfall, Snowfall, Shortwave and Longwave down radiation, surface pressure, surface specific humidity, North-dir and East-dir wind speed from available FLUXNET data (Air Temperature, Precipitation, Shortwave and Longwave down radiation, Vapour pressure deficit, Wind speed) and ERA-interim products when FLUXNET data are not available or not original data.
In order to fill the gaps with ERA-interim data, we first compare FLUXNET and ERA-interim data at 3-hour time resolution when both datasets are available and correct for systematic bias in order to use non-bias ERA-interim data when gaps.
Variables that are compared are :

  • Air Temperature
  • Shortwave and longwave down radiation
  • Water vapour pressure
  • Precipitation
  • Wind speed

Pressure is absent in the fluxnet datasets and is consequently directly taken from ERA-interim dataset.

For all fields except precipitation, we estimate the slope and intercept of the linear regression between Fluxnet and ERA-interim time series in order to correct for ERA-interim bias.
We constrain the intercept of the linear regression to equal 0 for the shortwave down radiation and the wind speed.
For precipitation, we simply compare the cumulative amounts over all the 6-hourly time steps where fluxnet and ERA-interim data are available.
Water Vapor Pressure from ERA-interim and Fluxnet products is calculated by using the Magnus Tetens relationship based on Air water deficit, Air temperature and Surface pressure (Murray, 1967,

When there are gaps in the Fluxnet time-series, 3-hourly non-bias ERA-interim data are used and consequently interpolate to match the half-hourly time resolution of the Fluxnet data. 'Air Temperature', 'Water Vapour Pressure', 'Wind speed', 'Longwave down Radiation' and 'Pressure' are linearly interpolated. 3-hourly precipitation are spread at half-hourly resolution using the observed mean frequency of precipitation. For the shortwave down radiation interpolation, we account for the solar angle evolution over the 3-hourly time period.

Last, in order to agree with the required meteorological fields by ORCHIDEE, precipitation is split into Rainfall and Snowfall by using a 0°C threshold and Water Vapor Pressure is converted in 'Air specific humidity' using the Magnus Tetens relationship.

Outputs of FLUXNET_DATA tool

FLUXNET_DATA creates a Netcdf file that contains all the meteorological fields requested by ORCHIDEE model. In addition, it contains a quality flag for each of the meteorological fields indicating when data are original (1) or derived from ERA-interim product (0). It also contained Fluxnet data for :

  • Net Ecosystem Exchange
  • Gross Primary Production
  • Ecosystem Respiration
  • Soil Water Content
  • Sensible Heat Flux
  • Soil Temperature
  • Latent Heat Flux
  • Relative Humidity
  • Canopy conductance
  • Potential Evapotranspiration

FLUXNET_DATA creates also a PDF file that contains charts comparing meteorological fields from Fluxnet and ERA-interim data. It gives information on the percentage of gaps for each meteorological field, the slope and intercept of linear regression between Fluxnet and ERA-interim time series and the RMSE between these datasets with and without bias correction. See below an example of PDF file created by FLUXNET_DATA tool.

What does FLUXNET_DATA tool contain ?

FLUXNET_DATA is a set of 11 Python scripts. is the main script. It first read the two input files, siteinfo.txt and configinfo.txt. Then, it performs a loop over the set of Fluxnet sites and will perform, for each, a suite of treatments.
The treatments performed for each site consist in:

  • reading and uploading the meteorological fields stored in the ERA-interim dataset for each year during which the Fluxnet site was monitored and for the specific site location (one grid point)
    • function read_climatology stored into
  • reading and uploading the meteorological fields and the monitored fiels stored int the FLUXNET dataset for each year during which the site was monitored.
    • functions read_weather and read_obs stored respectively into and
  • filling the gaps in the meteorological time series.
    • function gap_fill_func stored into
  • creating the PDF file.
    • function visu_plotlib_func stored into
  • adapting the variables unit for being in agreement with ORCHIDEE input standard.
    • function prepate_for_orchidee stored into
  • creating the NetCDF file.
    • function write_nc stored into

How to use FLUXNET_DATA tool ?

Simply, type :

mypronpt>> python 


Put the following command line in your .login :

source /home/users/jypeter/CDAT/Install/cdat_multi/cdat_multi.login /home/users/jypeter/CDAT/Install/cdat_multi --config LSCE_3

How to download FLUXNET_DATA tool ?

Simply, type:

my_prompt>> svn co --no-auth-cache  svn:// ./FLUXNET_DATA

This will create a subdirectory named 'FLUXNET_DATA'.