Ignore:
Timestamp:
Oct 20, 2014, 4:52:34 PM (10 years ago)
Author:
lguez
Message:

Added longitude and latitude to file "limit.nc", so that we can more easily
plot fields from this file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/limit_netcdf.F90

    r1907 r2128  
    2525  USE dimphy
    2626  USE ioipsl,             ONLY : ioget_year_len
    27   USE phys_state_var_mod, ONLY : pctsrf
     27  USE phys_state_var_mod, ONLY : pctsrf, rlon, rlat
    2828  USE netcdf,             ONLY : NF90_OPEN,    NF90_CREATE,  NF90_CLOSE,       &
    2929                   NF90_DEF_DIM, NF90_DEF_VAR, NF90_PUT_VAR, NF90_PUT_ATT,     &
     
    3131                   NF90_CLOBBER, NF90_ENDDEF,  NF90_UNLIMITED, NF90_FLOAT
    3232  USE inter_barxy_m, only: inter_barxy
     33  use netcdf95, only: nf95_def_var, nf95_put_att, nf95_put_var
    3334#endif
    3435  IMPLICIT NONE
     
    7576  INTEGER, DIMENSION(2) :: dims
    7677  INTEGER :: id_tim,  id_SST,  id_BILS, id_RUG, id_ALB
    77   INTEGER :: id_FOCE, id_FSIC, id_FTER, id_FLIC
     78  INTEGER :: id_FOCE, id_FSIC, id_FTER, id_FLIC, varid_longitude, varid_latitude
    7879  INTEGER :: NF90_FORMAT
    7980  INTEGER :: ndays                   !--- Depending on the output calendar
     
    220221  ierr=NF90_DEF_VAR(nid,"ALB",  NF90_FORMAT,dims,id_ALB)
    221222  ierr=NF90_DEF_VAR(nid,"RUG",  NF90_FORMAT,dims,id_RUG)
     223  call nf95_def_var(nid, "longitude", NF90_FLOAT, ndim, varid_longitude)
     224  call nf95_def_var(nid, "latitude", NF90_FLOAT, ndim, varid_latitude)
    222225
    223226  !--- Attributes creation
     
    232235  ierr=NF90_PUT_ATT(nid,id_RUG, "title","Rugosite")
    233236
     237  call nf95_put_att(nid, varid_longitude, "standard_name", "longitude")
     238  call nf95_put_att(nid, varid_longitude, "units", "degrees_east")
     239
     240  call nf95_put_att(nid, varid_latitude, "standard_name", "latitude")
     241  call nf95_put_att(nid, varid_latitude, "units", "degrees_north")
     242
    234243  ierr=NF90_ENDDEF(nid)
    235244
     
    244253  ierr=NF90_PUT_VAR(nid,id_ALB ,phy_alb(:,:),(/1,1/),(/klon,ndays/))
    245254  ierr=NF90_PUT_VAR(nid,id_RUG ,phy_rug(:,:),(/1,1/),(/klon,ndays/))
     255  call nf95_put_var(nid, varid_longitude, rlon)
     256  call nf95_put_var(nid, varid_latitude, rlat)
    246257
    247258  ierr=NF90_CLOSE(nid)
Note: See TracChangeset for help on using the changeset viewer.