source: BOL/LMDZ_Setup_amaury/interp_aerosols.sh @ 5075

Last change on this file since 5075 was 5010, checked in by abarral, 4 months ago

fix SPLA .DEF tracer file

File size: 1.3 KB
RevLine 
[4615]1#!/bin/bash
2
3. ./lmdz_env.sh
4
5ulimit -s unlimited
6
7year=$1
[4956]8echo "Dans interp_aerosols.sh year= $year"
[4615]9
10# Extraction d'un fichier de grille physique a partir de grilles_gcm.nc
11# ---------------------------------------------------------------------
12
13\rm -rf tmp*nc
[4956]14if [[ 0 = 0 ]]; then
15  imp1=$(ncdump -h grilles_gcm.nc | grep lonv | head -1 | awk ' { print $3 } ')
16  echo "$imp1"
17  (( imm1 = imp1 - 2 ))
18  echo "$imm1"
19  ncks -d "lonv,0,$imm1" grilles_gcm.nc -v phis -O grille_phys.nc
20  ncrename -v lonv,lon -v latu,lat -d lonv,lon -d latu,lat -O grille_phys.nc
21  ncap2 -s "lon=-360.+lon" grille_phys.nc -O tmp.nc
22  \mv -f tmp.nc grille_phys.nc
23  #exit 1
[4615]24fi
25
26# Recuperation des fichiers d'origine
27# -----------------------------------
28
29orig=aerosols${year}_from_inca.nc
[4956]30ln -s "$LMDZ_INIT/$orig" .
[4615]31
32
[5010]33# Interpolation horizontale sur la grille cible
[4615]34# ----------------------------------------------
35
36# Un cdo direct ne marche pas. Il faut donner la liste des variables ...
[4956]37vars=""
38for var in $(ncdump -h "$orig" | grep float | sed -e 's/^.*.float //' | cut -d'(' -f1 | sed -e 's/;//' -e /lat/d -e /lon/d); do
39  vars="$vars,$var"
40done
[4615]41
[4956]42echo cdo remapcon,grille_phys.nc "-selvar$vars" "$orig" tmp.nc
43cdo remapcon,grille_phys.nc "-selvar$vars" "$orig" tmp.nc
[4615]44#ncks -v ps,ap,b,presnivs $orig -A tmp.nc
[4956]45nccopy -k classic tmp.nc "aerosols.$year.nc"
Note: See TracBrowser for help on using the repository browser.