Index: XIOS/trunk/src/test/test_unstruct_complete.f90
===================================================================
--- XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 537)
+++ XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 549)
@@ -8,14 +8,14 @@
   INTEGER :: mpi_size
   INTEGER :: ierr
-  
+
   CHARACTER(len=*),PARAMETER :: id="client"
   INTEGER :: comm
   TYPE(xios_duration) :: dtime
   TYPE(xios_context) :: ctx_hdl
-  INTEGER, PARAMETER :: nlon=60 
+  INTEGER, PARAMETER :: nlon=60
   INTEGER, PARAMETER :: nlat=30
   INTEGER,PARAMETER :: ni_glo=100
-  INTEGER,PARAMETER :: nj_glo=100 
-  INTEGER,PARAMETER :: llm=5 
+  INTEGER,PARAMETER :: nj_glo=100
+  INTEGER,PARAMETER :: llm=5
   DOUBLE PRECISION  :: lval(llm)=1
   TYPE(xios_field) :: field_hdl
@@ -23,5 +23,5 @@
   TYPE(xios_file) :: file_hdl
   LOGICAL :: ok
-  
+
   DOUBLE PRECISION,ALLOCATABLE :: lon_glo(:),lat_glo(:)
   DOUBLE PRECISION,ALLOCATABLE :: bounds_lon_glo(:,:),bounds_lat_glo(:,:)
@@ -42,11 +42,11 @@
   INTEGER,ALLOCATABLE :: data_i_index(:)
   DOUBLE PRECISION,ALLOCATABLE :: field_A_compressed(:,:)
-  
+
   CALL xios_initialize(id,return_comm=comm)
   CALL MPI_COMM_RANK(comm,mpi_rank,ierr)
   CALL MPI_COMM_SIZE(comm,mpi_size,ierr)
-  
+
   CALL init_wait
-  
+
   ncell_glo=0
   DO j=1,nlat
@@ -55,5 +55,5 @@
     ncell_glo=ncell_glo+n
   ENDDO
-  
+
   ALLOCATE(lon_glo(ncell_glo))
   ALLOCATE(lat_glo(ncell_glo))
@@ -63,5 +63,5 @@
   ALLOCATE(field_A_glo(ncell_glo,llm))
   ALLOCATE(mask_glo(ncell_glo))
-   
+
   ind=0
   DO j=1,nlat
@@ -70,5 +70,5 @@
     if (j==nlat) PRINT*,"--- ",n
     IF (n<8) n=8
-    
+
     DO i=1,n
       ind=ind+1
@@ -76,21 +76,21 @@
       ilon=i-0.5
       ilat=j-0.5
-      
+
       lat_glo(ind)= 90-(ilat*180./nlat)
       lon_glo(ind)= (ilon*360./n)
-      
- 
+
+
       bounds_lat_glo(1,ind)= 90-((ilat-0.5)*180./nlat)
       bounds_lon_glo(1,ind)=((ilon-0.5)*360./n)
-      
+
       bounds_lat_glo(2,ind)= 90-((ilat-0.5)*180./nlat)
-      bounds_lon_glo(2,ind)=((ilon+0.5)*360./n) 
-          
+      bounds_lon_glo(2,ind)=((ilon+0.5)*360./n)
+
       bounds_lat_glo(3,ind)= 90-((ilat+0.5)*180./nlat)
-      bounds_lon_glo(3,ind)=((ilon+0.5)*360./n)     
+      bounds_lon_glo(3,ind)=((ilon+0.5)*360./n)
 
       bounds_lat_glo(4,ind)= 90-((ilat+0.5)*180./nlat)
       bounds_lon_glo(4,ind)=((ilon-0.5)*360./n)
-      
+
     ENDDO
   ENDDO
@@ -99,5 +99,5 @@
   rank=(mpi_size-1)/2
   ncell_x=sqrt(ncell_glo*1./mpi_size)
-  
+
   j1=nlat/2
   DO WHILE(rank>=0)
@@ -106,15 +106,15 @@
     n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
     np = MIN(n/ncell_x,rank+1) ;
-    if (j2==1) np=rank+1 
-    
+    if (j2==1) np=rank+1
+
     PRINT *,"domain ",j2,j1,rank,np ;
-    DO j=j2,j1  
+    DO j=j2,j1
       n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
       IF (n<8) n=8
       DO i=1,n
         ind=list_ind(i,j)
-        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN 
+        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN
           i_index_glo(ind) = rank - (i-1)/(n/np+1)
-        ELSE 
+        ELSE
           i_index_glo(ind) = rank-(MOD(n,np)+ (i-1-MOD(n,np)*(n/np+1))/(n/np))
         ENDIF
@@ -124,8 +124,8 @@
     j1=j2-1
   ENDDO
-        
+
   rank=(mpi_size-1)/2+1
   ncell_x=sqrt(ncell_glo*1./mpi_size)
-  
+
   j1=nlat/2+1
   DO WHILE(rank<=mpi_size-1)
@@ -134,15 +134,15 @@
     n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
     np = MIN(n/ncell_x,mpi_size-rank) ;
-    if (j2==nlat) np=mpi_size-rank 
-    
+    if (j2==nlat) np=mpi_size-rank
+
     PRINT *,"domain ",j2,j1,rank,np ;
-    DO j=j1,j2  
+    DO j=j1,j2
       n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
       IF (n<8) n=8
       DO i=1,n
         ind=list_ind(i,j)
-        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN 
+        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN
           i_index_glo(ind) = rank + (i-1)/(n/np+1)
-        ELSE 
+        ELSE
           i_index_glo(ind) = rank+(MOD(n,np)+ (i-1-MOD(n,np)*(n/np+1))/(n/np))
         ENDIF
@@ -152,5 +152,5 @@
     j1=j2+1
   ENDDO
-    
+
   ncell=0
   DO ind=1,ncell_glo
@@ -183,5 +183,5 @@
     ENDIF
   ENDDO
-  
+
   ALLOCATE(field_A_compressed(data_n_index,llm))
   ALLOCATE(data_i_index(data_n_index))
@@ -194,11 +194,13 @@
     ENDIF
   ENDDO
-      
-  
-  
+
   CALL xios_context_initialize("surface",comm)
   CALL xios_get_handle("surface",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
+
+  CALL xios_define_calendar(type="Julian", &
+                            start_date=xios_date(2012, 03, 01, 15, 00, 00), &
+                            time_origin=xios_date(2012, 02, 29, 15, 00, 00))
+
   CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
   CALL xios_set_domain_attr("domain_srf",ni_glo=ncell_glo, ni=ncell, ibegin=1, i_index=RESHAPE(i_index,(/ncell,1/) ))
@@ -206,22 +208,22 @@
   CALL xios_set_domain_attr("domain_srf",lonvalue=lon,latvalue=lat)
   CALL xios_set_domain_attr("domain_srf", nvertex=4, bounds_lon=bounds_lon, bounds_lat=bounds_lat )
-    
- 
+
+
   dtime%second=3600
   CALL xios_set_context_attr("surface", timestep=dtime)
   CALL xios_close_context_definition()
-    
+
    DO ts=1,24*10
      CALL xios_update_calendar(ts)
      CALL xios_send_field("field_A_srf",field_A_compressed)
     ENDDO
-  
+
     CALL xios_context_finalize()
     CALL xios_finalize()
-  
+
   END PROGRAM test_unstruct_complete
 
 
-  
-
-  
+
+
+
