Ignore:
Timestamp:
Apr 28, 2011, 5:21:47 PM (14 years ago)
Author:
jghattas
Message:

Added 4 more variables in output file grilles_gcm.nc created by ce0l :
lev, phis, aire and mask. These variables are needed by INCA.

A Cozic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/dyn3d/grilles_gcm_netcdf_sub.F90

    r1492 r1511  
    77! part in the program create_fausse_var.
    88!
    9 SUBROUTINE grilles_gcm_netcdf_sub
     9SUBROUTINE grilles_gcm_netcdf_sub(masque,phis)
    1010
    1111  IMPLICIT NONE
     
    1919  INCLUDE "serre.h"
    2020
     21
     22  REAL,DIMENSION(iip1,jjp1),INTENT(IN)  :: masque ! masque terre/mer
     23  REAL,DIMENSION(iip1,jjp1),INTENT(IN)  :: phis   ! geopotentiel au sol
     24
    2125  REAL temp(iim+1,jjm+1)
    2226  ! Attributs netcdf sortie
    2327  INTEGER ncid_out,rcode_out
    24   INTEGER out_lonuid,out_lonvid,out_latuid,out_latvid
     28  INTEGER out_lonuid,out_lonvid,out_latuid,out_latvid,out_levid
    2529  INTEGER out_varid
    2630  INTEGER out_lonudim,out_lonvdim
    2731  INTEGER out_latudim,out_latvdim,out_dim(3)
     32  INTEGER out_levdim
    2833
    2934  INTEGER, PARAMETER :: longcles = 20
     
    3338
    3439  INTEGER status,i,j
    35   REAL rlatudeg(jjp1),rlatvdeg(jjm)
     40  REAL rlatudeg(jjp1),rlatvdeg(jjm),rlevdeg(llm)
    3641  REAL rlonudeg(iip1),rlonvdeg(iip1)
    3742
    3843  REAL dlon1(iip1),dlon2(iip1),dlat1(jjp1),dlat2(jjp1)
    3944  REAL acoslat,dxkm,dykm,resol(iip1,jjp1)
    40 
     45  REAL,DIMENSION(iip1,jjp1)  :: phis_loc
     46  INTEGER masque_int(iip1,jjp1)
     47  INTEGER :: phis_id
     48  INTEGER :: area_id
     49  INTEGER :: mask_id
     50 
    4151  rad = 6400000
    4252  omeg = 7.272205e-05
     
    165175#endif
    166176
    167 
     177  ! On re-ouvre le fichier pour rajouter 4 nouvelles variables necessaire pour INCA
     178! lev - phis - aire - mask
     179  rlevdeg(:) = presnivs
     180  phis_loc(:,:) = phis(:,:)/g
     181
     182! niveaux de pression verticaux
     183  status = NF_REDEF (ncid_out)
     184  status=NF_DEF_DIM(ncid_out,'lev',llm,out_levdim)
     185 
     186! fields
     187  out_dim(1)=out_lonvdim
     188  out_dim(2)=out_latudim
     189
     190  status = nf_def_var(ncid_out,'phis',NF_FLOAT,2,out_dim,phis_id)
     191  CALL handle_err(status)
     192  status = nf_def_var(ncid_out,'aire',NF_FLOAT,2,out_dim,area_id)
     193  CALL handle_err(status)
     194  status = nf_def_var(ncid_out,'mask',NF_INT  ,2,out_dim,mask_id)
     195  CALL handle_err(status)
     196
     197  status=NF_ENDDEF(ncid_out)
     198
     199  ! ecriture des variables
     200#ifdef NC_DOUBLE
     201  status=NF_PUT_VARA_DOUBLE(ncid_out,out_levid,1,llm,rlevdeg)
     202#else
     203  status=NF_PUT_VARA_REAL(ncid_out,out_levid,1,llm,rlevdeg)
     204#endif
     205
     206  start(1)=1
     207  start(2)=1
     208  start(3)=1
     209  start(4)=0
     210  COUNT(1)=iip1
     211  COUNT(2)=jjp1
     212  COUNT(3)=1
     213  COUNT(4)=0
     214
     215  status = nf_put_vara_double(ncid_out, phis_id,start,count, phis_loc)
     216  status = nf_put_vara_double(ncid_out, area_id,start,count, aire)
     217  masque_int(:,:) = nINT(masque(:,:))
     218  status = nf_put_vara_int(ncid_out, mask_id,start,count,masque_int)
     219  CALL handle_err(status)
     220 
    168221  ! fermeture du fichier netcdf
    169222  CALL ncclos(ncid_out,rcode_out)
Note: See TracChangeset for help on using the changeset viewer.