Index: trunk/LMDZ.PLUTO/deftank/xios/file_def_physics.xml
===================================================================
--- trunk/LMDZ.PLUTO/deftank/xios/file_def_physics.xml	(revision 3693)
+++ trunk/LMDZ.PLUTO/deftank/xios/file_def_physics.xml	(revision 3694)
@@ -29,5 +29,5 @@
             </field_group>
 
-            <field_group  operation="instant"
+            <field_group  operation="once"
                           grid_ref="altitude_grid"
                           freq_op="1ts">
@@ -44,4 +44,5 @@
                            freq_op="1ts">
                   <field field_ref="area" operation="once" />
+                  <field field_ref="phisfi" operation="once" />
                   <field field_ref="ps" enabled="true" />
                   <field field_ref="ISR" enabled="true" />
Index: trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90
===================================================================
--- trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90	(revision 3693)
+++ trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90	(revision 3694)
@@ -2129,4 +2129,5 @@
       call write_output("ps","Surface pressure","Pa",ps)
       call write_output("emis","Emissivity","",emis)
+      call write_output('phisfi','Surface Geopotential','m2s-2',phisfi)
       if (grid_type == regular_lonlat) then
           call write_output("area","Mesh area","m2", &
@@ -2168,5 +2169,5 @@
          call write_output("zzlay","Midlayer altitude", "m",zzlay(:,:))
          call write_output("zzlev","Interlayer altitude", "m",zzlev(:,1:nlayer))
-         !call write_output('pphi','Geopotential',' ',pphi)
+         call write_output('pphi','Geopotential','m2s-2',pphi)
 
          call write_output("temperature","temperature","K",zt)
Index: trunk/LMDZ.PLUTO/util/zrecast_plut.F90
===================================================================
--- trunk/LMDZ.PLUTO/util/zrecast_plut.F90	(revision 3693)
+++ trunk/LMDZ.PLUTO/util/zrecast_plut.F90	(revision 3694)
@@ -356,23 +356,31 @@
   ierr=NF_INQ_DIMID(infid,"time",tmpdimid)
   if (ierr.ne.NF_NOERR) then
-    stop "Error: Failed to get lon dimension ID"
-  else
-    ierr=NF_INQ_VARID(infid,"time",tmpvarid)
+    write(*,*) "Could not get time dimension ID"
+    write(*,*) "  looking for time_counter dimension instead... "
+    ierr=NF_INQ_DIMID(infid,"time_counter",tmpdimid)
     if (ierr.ne.NF_NOERR) then
-      stop "Error: Failed to get time ID"
+      stop "Error: Failed to get time/Time/time_counter dimension ID"
     else
-      ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength)
+      ierr=NF_INQ_VARID(infid,"time",tmpvarid)
       if (ierr.ne.NF_NOERR) then
-        stop "Error: Failed to get time length"
+        ierr=NF_INQ_VARID(infid,"time_instant",tmpvarid)
+      endif
+      if (ierr.ne.NF_NOERR) then
+        stop "Error: Failed to get time ID"
       else
-        allocate(time(timelength),stat=ierr)
-        if (ierr.ne.0) then
-          write(*,*) "Error: Failed to allocate time(timelength)"
-          write(*,*) "     timelength=",timelength
-          stop
-        endif
-        ierr=NF_GET_VAR_REAL(infid,tmpvarid,time)
+        ierr=NF_INQ_DIMLEN(infid,tmpdimid,timelength)
         if (ierr.ne.NF_NOERR) then
-          stop "Error: Failed reading time"
+          stop "Error: Failed to get time length"
+        else
+          allocate(time(timelength),stat=ierr)
+          if (ierr.ne.0) then
+            write(*,*) "Error: Failed to allocate time(timelength)"
+            write(*,*) "     timelength=",timelength
+            stop
+          endif
+          ierr=NF_GET_VAR_REAL(infid,tmpvarid,time)
+          if (ierr.ne.NF_NOERR) then
+            stop "Error: Failed reading time"
+          endif
         endif
       endif
@@ -449,34 +457,71 @@
   ierr=NF_INQ_VARID(infid,"aps",tmpvarid)
   if (ierr.ne.NF_NOERR) then
-    stop "Error: Failed to get aps ID"
+    write(*,*) "Problem: Could not find aps"
+    infile2="start.nc"
+    write(*,*) "         Trying file ",trim(infile2)
+    ierr=NF_OPEN(infile2,NF_NOWRITE,infid2)
+    if (ierr.ne.NF_NOERR) then
+      write(*,*) "Error: Could not open that file either"
+      stop "Might as well stop here"
+    endif
   else
-    allocate(aps(altlength),stat=ierr)
-    if (ierr.ne.0) then
-      write(*,*) "Error: Failed to allocate aps(altlength)"
-      write(*,*) "     altlength=",altlength
-      stop
-    endif
-    ierr=NF_GET_VAR_REAL(infid,tmpvarid,aps)
-    if (ierr.ne.NF_NOERR) then
-      stop "Error: Failed reading aps"
-    endif
+    ! reopen file using infid2
+    ierr=NF_OPEN(infile,NF_NOWRITE,infid2)
   endif
+
+  ierr=NF_INQ_VARID(infid2,"aps",tmpvarid)
+  if (ierr.ne.NF_NOERR) then
+      stop "Error: Failed to get aps ID"
+  endif
+
+  allocate(aps(altlength),stat=ierr)
+  if (ierr.ne.0) then
+    write(*,*) "Error: Failed to allocate aps(altlength)"
+    write(*,*) "     altlength=",altlength
+    stop
+  endif
+  ierr=NF_GET_VAR_REAL(infid2,tmpvarid,aps)
+  if (ierr.ne.NF_NOERR) then
+    stop "Error: Failed reading aps"
+  endif
+
+  write(*,*) 'OK, got aps'
+  ierr=NF_CLOSE(infid2)
 
   ! hybrid coordinate bps
   ierr=NF_INQ_VARID(infid,"bps",tmpvarid)
   if (ierr.ne.NF_NOERR) then
-    stop "Error: Failed to get bps ID"
+    write(*,*) "Problem: Could not find bps"
+    infile2="start.nc"
+    write(*,*) "         Trying file ",trim(infile2)
+    ierr=NF_OPEN(infile2,NF_NOWRITE,infid2)
+    print*, "here"
+    if (ierr.ne.NF_NOERR) then
+      write(*,*) "Error: Could not open that file either"
+      stop "Might as well stop here"
+    endif
   else
-    allocate(bps(altlength),stat=ierr)
-    if (ierr.ne.0) then
-      write(*,*) "Error: Failed to allocate bps(altlength)"
-      write(*,*) "     altlength=",altlength
-      stop
-    endif
-    ierr=NF_GET_VAR_REAL(infid,tmpvarid,bps)
-    if (ierr.ne.NF_NOERR) then
-      stop "Error: Failed reading bps"
-    endif
+    ! reopen file using infid2
+    ierr=NF_OPEN(infile,NF_NOWRITE,infid2)
   endif
+
+  ierr=NF_INQ_VARID(infid2,"bps",tmpvarid)
+  if (ierr.ne.NF_NOERR) then
+      stop "Error: Failed to get bps ID"
+  endif
+
+  allocate(bps(altlength),stat=ierr)
+  if (ierr.ne.0) then
+    write(*,*) "Error: Failed to allocate bps(altlength)"
+    write(*,*) "     altlength=",altlength
+    stop
+  endif
+  ierr=NF_GET_VAR_REAL(infid2,tmpvarid,bps)
+  if (ierr.ne.NF_NOERR) then
+    stop "Error: Failed reading bps"
+  endif
+
+  write(*,*) 'OK, got bps'
+  ierr=NF_CLOSE(infid2)
 endif !of if (.not.have_sigma)
 
@@ -498,5 +543,5 @@
   if (ierr.ne.NF_NOERR) then
     write(*,*) "Problem: Could not find/open that file"
-    infile2="phisinit.nc"
+    infile2="startfi.nc"
     write(*,*) "         Trying file ",trim(infile2)
     ierr=NF_OPEN(infile2,NF_NOWRITE,infid2)
@@ -510,5 +555,8 @@
   ierr=NF_INQ_VARID(infid2,"phisinit",tmpvarid)
   if (ierr.ne.NF_NOERR) then
-    stop "Error: Failed to get phisinit ID"
+    ierr=NF_INQ_VARID(infid2,"phisfi",tmpvarid)
+    if (ierr.ne.NF_NOERR) then
+      stop "Error: Failed to get phisinit/phisfi ID"
+    endif
   endif
   ! Get physinit
@@ -773,5 +821,5 @@
 endif
 
-ierr=NF_INQ_VARID(infid,"temp",tmpvarid)
+ierr=NF_INQ_VARID(infid,"temperature",tmpvarid)
 if (ierr.ne.NF_NOERR) then
   ! stop "Error: Failed to get temp ID"
@@ -779,9 +827,5 @@
   ierr=NF_INQ_VARID(infid,"t",tmpvarid)
   if (ierr.ne.NF_NOERR) then
-   !  stop "Error: Failed to get t ID"
-    ierr=NF_INQ_VARID(infid,"temperature",tmpvarid)
-    if (ierr.ne.NF_NOERR) then
-      stop "Error: Failed to get temperature ID"
-    endif
+    stop "Error: Failed to get t ID"
   else
     ierr=NF_GET_VAR_REAL(infid,tmpvarid,temp)
@@ -1322,5 +1366,5 @@
     if (ierr.ne.NF_NOERR) then
       write(*,*) "Error failed to copy long_name attribute:",trim(text)
-      stop ""
+      stop " "
     endif
   endif
@@ -1336,5 +1380,5 @@
     if (ierr.ne.NF_NOERR) then
       write(*,*) "Error failed to copy units attribute:",trim(text)
-      stop ""
+      stop " "
     endif
   endif
