Ignore:
Timestamp:
Jun 16, 2015, 7:01:30 PM (9 years ago)
Author:
slebonnois
Message:

SL: corrections in Titan and Venus tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/Tools/tem.F90

    r816 r1454  
    3737integer,dimension(3) :: datashape3d ! shape of 3D datasets
    3838
    39 real :: miss_val=9.99e+33 ! special "missing value" to specify missing data
    40 real,parameter :: miss_val_def=9.99e+33 ! default value for "missing value"
     39real :: miss_val ! special "missing value" to specify missing data
     40real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value"
    4141real :: pi
    4242real,dimension(:),allocatable :: lon ! longitude
    4343integer lonlength ! # of grid points along longitude
    4444real,dimension(:),allocatable :: lat ! latitude
    45 real,dimension(:),allocatable :: latrad ! latitude in radian
     45real,dimension(:),allocatable :: coslat ! cos of latitude
    4646integer latlength ! # of grid points along latitude
    4747real,dimension(:),allocatable :: plev ! Pressure levels (Pa)
     
    107107
    108108pi = 2.*asin(1.)
     109miss_val = miss_val_def
    109110
    110111write(*,*) ""
     
    145146if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat"
    146147
    147 allocate(latrad(latlength))
    148 latrad = lat*pi/180.
     148allocate(coslat(latlength))
     149! Beware of rounding problems at poles...
     150coslat(:) = max(0.,cos(lat(:)*pi/180.))
    149151
    150152! Lat, lon pressure intervals
    151 deltalat = abs(latrad(2)-latrad(1))
     153deltalat = abs(lat(2)-lat(1))*pi/180.
    152154deltalon = abs(lon(2)-lon(1))*pi/180.
    153155
     
    196198
    197199text="temp"
    198 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2)
     200call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2)
    199201if (ierr1.ne.NF_NOERR) then
    200202  write(*,*) "  looking for t instead... "
    201203  text="t"
    202   call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2)
     204  call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2)
    203205  if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID"
    204206endif
     
    214216! zonal wind vitu (in m/s)
    215217text="vitu"
    216 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,ierr1,ierr2)
     218call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2)
    217219if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID"
    218220if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind"
     
    220222! meridional wind vitv (in m/s)
    221223text="vitv"
    222 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,ierr1,ierr2)
     224call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2)
    223225if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID"
    224226if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind"
     
    226228! vertical wind vitw (in Pa/s)
    227229text="vitw"
    228 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,ierr1,ierr2)
     230call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2)
    229231if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID"
    230232if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind"
     
    238240
    239241! text="zareoid"
    240 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,ierr1,ierr2)
     242! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2)
    241243! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID"
    242244! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid"
     
    312314 grav(lonlength+1,:,:,:) =  grav(1,:,:,:)
    313315
    314 call cellmass(infid,latlength,lonlength+1,altlength,timelength, &
    315               lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &
     316call cellmass(infid,latlength,lonlength+1,altlength,timelength,lmdflag, &
     317              miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, &
    316318              dmass )
    317319
     
    359361call moyzon(lonlength,latlength,altlength,miss_val,u3d,ubar)
    360362
    361 call epflux(lonlength+1,latlength,altlength,miss_val,latrad,rbar &
     363call epflux(lonlength+1,latlength,altlength,miss_val,lat,rbar &
    362364            ,teta,u3d,v3d,w3d,plev &
    363365            ,epy2d,epz2d,div2d,vtem2d,wtem2d,ammc2d &
     
    376378! rsurg: r*dp/g = dm/(r cos(lat) dlon dlat) !!!
    377379     rsurg(ilon,ilat,ilev) = dmass(ilon,ilat,ilev,itim) &
    378           / (r3d(ilon,ilat,ilev)*cos(latrad(ilat))*deltalon*deltalat)
     380          / (r3d(ilon,ilat,ilev)*coslat(ilat)*deltalon*deltalat)
    379381    else
    380382     rsurg(ilon,ilat,ilev) = miss_val
     
    391393        (rsurgbar(ilat,ilev).ne.miss_val) ) then
    392394      vm(ilat,ilev) = vtem2d(ilat,ilev) &
    393             * 2.*pi*rsurgbar(ilat,ilev)*cos(latrad(ilat))
     395            * 2.*pi*rsurgbar(ilat,ilev)*coslat(ilat)
    394396    else
    395397      vm(ilat,ilev) = miss_val
Note: See TracChangeset for help on using the changeset viewer.