Ignore:
Timestamp:
Feb 18, 2014, 10:59:29 AM (11 years ago)
Author:
Ehouarn Millour
Message:

Cleanup and update of "grilles_gcm_netcdf_sub": removed old version, removed flag "grilles_gcm_netcdf" used to trigger output of grilles_gcm.nc file (file will now always be created) and fixed writing vertical levels presnivs in the file.
JBM+EM

Location:
LMDZ5/trunk/libf/dyn3d_common
Files:
1 deleted
1 edited

Legend:

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

    r1952 r1984  
    11!
    2 ! $Header$
     2! $Id: $
    33!
    44! This subroutine creates the file grilles_gcm.nc containg longitudes and
    55! latitudes in degrees for grid u and v. This subroutine is called from
    6 ! ce0l if grilles_gcm_netcdf=TRUE. This subroutine corresponds to the first
     6! ce0l. This subroutine corresponds to the first
    77! part in the program create_fausse_var.
    88!
     
    4848  INTEGER :: area_id
    4949  INTEGER :: mask_id
     50  INTEGER :: presnivs_id
    5051 
    5152  rad = 6400000
     
    8081  ! CREATION OUTPUT
    8182  ! ouverture fichier netcdf de sortie out
    82   status=NF_CREATE('grilles_gcm.nc',NF_NOCLOBBER,ncid_out)
     83  status=NF_CREATE('grilles_gcm.nc',NF_CLOBBER,ncid_out)
     84  CALL handle_err(status)
    8385  status=NF_DEF_DIM(ncid_out,'lonu',iim+1,out_lonudim)
     86  CALL handle_err(status)
    8487  status=NF_DEF_DIM(ncid_out,'lonv',iim+1,out_lonvdim)
     88  CALL handle_err(status)
    8589  status=NF_DEF_DIM(ncid_out,'latu',jjm+1,out_latudim)
     90  CALL handle_err(status)
    8691  status=NF_DEF_DIM(ncid_out,'latv',jjm,out_latvdim)
     92  CALL handle_err(status)
    8793
    8894
     
    136142
    137143  status=NF_ENDDEF(ncid_out)
     144  write(*,*) "COUCOU 6"
     145  CALL handle_err(status)
    138146  ! 5) ----- FERMETURE DES FICHIERS NETCDF------------------
    139147  ! --------------------------------------------------------
     
    143151#ifdef NC_DOUBLE
    144152  status=NF_PUT_VARA_DOUBLE(ncid_out,out_lonuid,1,iim+1,rlonudeg)
     153  CALL handle_err(status)
    145154  status=NF_PUT_VARA_DOUBLE(ncid_out,out_lonvid,1,iim+1,rlonvdeg)
     155  CALL handle_err(status)
    146156  status=NF_PUT_VARA_DOUBLE(ncid_out,out_latuid,1,jjm+1,rlatudeg)
     157  CALL handle_err(status)
    147158  status=NF_PUT_VARA_DOUBLE(ncid_out,out_latvid,1,jjm,rlatvdeg)
     159  CALL handle_err(status)
    148160#else
    149161  status=NF_PUT_VARA_REAL(ncid_out,out_lonuid,1,iim+1,rlonudeg)
     162  CALL handle_err(status)
    150163  status=NF_PUT_VARA_REAL(ncid_out,out_lonvid,1,iim+1,rlonvdeg)
     164  CALL handle_err(status)
    151165  status=NF_PUT_VARA_REAL(ncid_out,out_latuid,1,jjm+1,rlatudeg)
     166  CALL handle_err(status)
    152167  status=NF_PUT_VARA_REAL(ncid_out,out_latvid,1,jjm,rlatvdeg)
     168  CALL handle_err(status)
    153169#endif
    154170
     
    171187#ifdef NC_DOUBLE
    172188  status=NF_PUT_VARA_DOUBLE(ncid_out,out_varid,start, count,temp)
     189  CALL handle_err(status)
    173190#else
    174191  status=NF_PUT_VARA_REAL(ncid_out,out_varid,start, count,temp)
     192  CALL handle_err(status)
    175193#endif
    176194
    177195  ! On re-ouvre le fichier pour rajouter 4 nouvelles variables necessaire pour INCA
    178196! lev - phis - aire - mask
    179   rlevdeg(:) = presnivs
     197! rlevdeg(:) = presnivs
     198  rlevdeg(:) = presnivs(:)
    180199  phis_loc(:,:) = phis(:,:)/g
    181200
    182201! niveaux de pression verticaux
    183202  status = NF_REDEF (ncid_out)
     203  CALL handle_err(status)
    184204  status=NF_DEF_DIM(ncid_out,'lev',llm,out_levdim)
     205  CALL handle_err(status)
     206  status=NF_DEF_VAR(ncid_out,'presnivs',NF_FLOAT,1,out_levdim,&
     207                    presnivs_id)
     208  CALL handle_err(status)
    185209 
    186210! fields
     
    196220
    197221  status=NF_ENDDEF(ncid_out)
     222  CALL handle_err(status)
    198223
    199224  ! ecriture des variables
    200225#ifdef NC_DOUBLE
    201   status=NF_PUT_VARA_DOUBLE(ncid_out,out_levid,1,llm,rlevdeg)
     226  status=NF_PUT_VARA_DOUBLE(ncid_out,presnivs_id,1,llm,rlevdeg)
     227  CALL handle_err(status)
    202228#else
    203229  status=NF_PUT_VARA_REAL(ncid_out,out_levid,1,llm,rlevdeg)
     230  CALL handle_err(status)
    204231#endif
    205232
     
    214241
    215242  status = nf_put_vara_double(ncid_out, phis_id,start,count, phis_loc)
     243  CALL handle_err(status)
    216244  status = nf_put_vara_double(ncid_out, area_id,start,count, aire)
     245  CALL handle_err(status)
    217246  masque_int(:,:) = nINT(masque(:,:))
    218247  status = nf_put_vara_int(ncid_out, mask_id,start,count,masque_int)
Note: See TracChangeset for help on using the changeset viewer.