source: trunk/TOOLS/WOOD_HARVEST/genere_woodharvest_scenarios_final_perscenario_extension.ksh @ 8616

Last change on this file since 8616 was 6094, checked in by josefine.ghattas, 5 years ago

Add scripts for woodharvest used for the extension of CMIP6 scenarios.

  1. Vuichard
File size: 1.8 KB
Line 
1#!/bin/ksh
2# Script for post-treatment to be launched after genere_woodharvest_scenarios_extension.ksh.
3# The script does following:
4# - rename some dimensions and variables
5# - change to netcdf4 format
6# - add a description attribute to the netcdf file.
7#
8# This script takes as argument the name of the scenario to be used.
9# The script has been used on the scenarios MAGPIE-ssp585-2-1-e IMAGE-ssp126-2-1-e MAGPIE-ssp534-2-1-e
10#
11# Script done by N. Vuichard
12#
13files=`find /home/surface7/vuichard/LandUseMap_CMIP6/$1/outputs/ -name "*woodharvest*"`
14
15
16for i in $files
17do
18  dir=`echo $i | sed -e "s/\(.*\/\).*/\1/"`
19  year=`echo $i| sed -e "s/\(.*woodharvest_\)\(.*\)\.nc/\2/"`
20  echo $i $dir $year
21  file=${dir}"woodharvest_"${year}".nc"
22  echo ${file}
23  cp $i ${file}
24  ncwa -a TIME ${file} temp.nc
25  ncks -C -O -x -v TIME temp.nc temp.nc
26  ncrename -v WOODHARVEST,woodharvest temp.nc
27  ncrename -d LAT,latitude temp.nc
28  ncrename -d LON,longitude temp.nc
29  ncrename -v LAT,latitude temp.nc
30  ncrename -v LON,longitude temp.nc
31  mv temp.nc ${file}
32  #ncap2 -O -s 'where (woodharvest < 0.) woodharvest=0.' woodharvest_${i}.nc woodharvest_${i}.nc
33  ncatted -a long_name,woodharvest,o,c,"Harvested wood biomass" ${file}
34  ncatted -a cell_methods,woodharvest,d,, ${file}
35  ncatted -a units,woodharvest,o,c,"gC m-2[forest]" ${file}
36  ncatted -a description,global,o,c,"This data is derived from LUH2v2h for CMIP6. It is computed as the total wood biomass (primf_bioh+primn_bioh+secmf_bioh+secyf_bioh+secnf_bioh) divided by the related land cell area ((primf+primn+secdf+secdn)*area). The ferret script used for generating this data has been stored at http://forge.ipsl.jussieu.fr/igcmg/browser/TOOLS/CMIP6_FORCING/WOOD_HARVEST/genere_woodharvest_scenarios_extension.jnl. Done by N. Vuichard, LSCE, June 25, 2019" ${file}
37  ncks -O -4 ${file} ${file}
38done
39
Note: See TracBrowser for help on using the repository browser.