Index: /trunk/LMDZ.MARS/util/zrecast.F90
===================================================================
--- /trunk/LMDZ.MARS/util/zrecast.F90	(revision 359)
+++ /trunk/LMDZ.MARS/util/zrecast.F90	(revision 360)
@@ -101,4 +101,5 @@
 real,dimension(:,:,:,:),allocatable :: press ! GCM atmospheric pressure 
 real,dimension(:,:,:,:),allocatable :: temp ! GCM atmospheric temperature
+real,dimension(:,:,:,:),allocatable :: teta ! GCM atmospheric potential temperature
 real,dimension(:,:,:,:),allocatable :: rho ! GCM atmospheric density
 real,dimension(:,:,:,:),allocatable :: za_gcm ! GCM above areoid levels (m)
@@ -773,4 +774,13 @@
 endif
 
+allocate(teta(lonlength,latlength,altlength,timelength),stat=ierr)
+if (ierr.ne.0) then
+  write(*,*) "Error: Failed to allocate teta(lonlength,latlength,altlength,timelength)"
+  write(*,*) "       lonlength=",lonlength," latlength=",latlength
+  write(*,*) "       altlength=",altlength," timelength=",timelength
+  stop
+endif
+
+
 ierr=NF_INQ_VARID(infid,"temp",tmpvarid)
 if (ierr.ne.NF_NOERR) then
@@ -779,10 +789,23 @@
   ierr=NF_INQ_VARID(infid,"t",tmpvarid)
   if (ierr.ne.NF_NOERR) then
-    stop "Error: Failed to get t ID"
-  else
-    ierr=NF_GET_VAR_REAL(infid,tmpvarid,temp)
-    if (ierr.ne.NF_NOERR) then
-      stop "Error: Failed reading atmospheric temperature"
-    endif
+     ierr=NF_INQ_VARID(infid,"teta",tmpvarid)
+     if (ierr.ne.NF_NOERR) then
+       stop "Error: Failed to get t or teta ID"
+     endif
+       ierr=NF_GET_VAR_REAL(infid,tmpvarid,teta)
+       if (ierr.ne.NF_NOERR) then
+         stop "Error: Failed reading atmospheric temperature"
+       endif
+     
+  do itim=1,timelength
+    do ilev=1,altlength
+      do ilat=1,latlength
+        do ilon=1,lonlength
+          temp(ilon,ilat,ilev,itim)=teta(ilon,ilat,ilev,itim)*(press(ilon,ilat,ilev,itim)/ps(ilon,ilat,itim))**(.256793)
+        enddo
+      enddo
+    enddo
+  enddo
+
   endif
 else
