wiki:Scripts/FluxnetValidation/DataProcessing

Version 13 (modified by avalade, 3 months ago) (diff)

--

What is FLUXNET_DATA ?

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.

This gapfilling procedure is detailed and evaluated in Vuichard and Papale (2015)

Input requirements

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

gapfilling.py

Update the name of the configinfo file to be read (2 instances) by changing the path with your own path : nomfic = '/home/users/vuichard/ORCHIDEE_SVN/trunk/TOOLS/FLUXNET_DATA/configinfo.txt'

siteinfo.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

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)

Functioning

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, http://cires.colorado.edu/~voemel/vp.html).

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.
http://dods.ipsl.jussieu.fr/orchidee/WIKI/RU-Zot_2002-2004.png

What does FLUXNET_DATA tool contain ?

FLUXNET_DATA is a set of 11 Python scripts.
gapfilling.py 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 read_climatology.py).
  • 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 read_weather.py and read_obs.py
  • filling the gaps in the meteorological time series.
    • function gap_fill_func stored into gap_fill.py
  • creating the PDF file.
    • function visu_plotlib_func stored into visu_plotlib.py
  • adapting the variables unit for being in agreement with ORCHIDEE input standard.
    • function prepate_for_orchidee stored into input_nc_orchidee.py
  • creating the NetCDF file.
    • function write_nc stored into input_nc_orchidee.py

How to use FLUXNET_DATA tool ?

Simply, type :

mypronpt>> python gapfilling.py 

Requirement

mypronpt>>module purge

mypronpt>>source ~jypeter/.conda3_jyp.sh

mypronpt>>conda activate cdatm_py2

How to download FLUXNET_DATA tool ?

Simply, type:

my_prompt>> svn co --no-auth-cache  svn://forge.ipsl.jussieu.fr/orchidee/trunk/TOOLS/FLUXNET_DATA ./FLUXNET_DATA

This will create a subdirectory named 'FLUXNET_DATA'.