Index: IOIPSL/trunk/src/fliocom.f90
===================================================================
--- IOIPSL/trunk/src/fliocom.f90	(revision 329)
+++ IOIPSL/trunk/src/fliocom.f90	(revision 362)
@@ -171,5 +171,5 @@
 !!   Attributes        Values
 !!   'axis'            "Z"
-!!   'standard_name'   "level"
+!!   'standard_name'   "model_level_number"
 !!   'units'           "sigma_level"
 !!   'long_name'       "Sigma Levels"
@@ -613,5 +613,8 @@
 !! which are spatio-temporal coordinates (x/y/z/t).
 !!
-!!-- Rule 1 : we look for a correct "axis" attribute
+!!-- Rule 1 : we look for a variable with one dimension
+!!--          and which has the same name as its dimension
+!!
+!!-- Rule 2 : we look for a correct "axis" attribute
 !!
 !!  Axis       Axis attribute             Number of dimensions
@@ -623,16 +626,24 @@
 !!    t         T                         1
 !!
-!!-- Rule 2 : we look for a specific name
-!!
-!!  Axis       Names
-!!
-!!    x        'nav_lon' 'lon'     'longitude'
-!!    y        'nav_lat' 'lat'     'latitude'
-!!    z        'depth'   'deptht'  'height'       'level'
-!!             'lev'     'plev'    'sigma_level'  'layer'
-!!    t        'time'    'tstep'   'timesteps'
-!!
-!!-- Rule 3 : we look for a variable with one dimension
-!!--          and which has the same name as its dimension
+!!-- Rule 3 : we look for a correct "standard_name" attribute
+!!
+!!  Axis       Axis attribute          Number of dimensions
+!!             (case insensitive)
+!!
+!!    x         longitude              1/2
+!!    y         latitude               1/2
+!!    z         model_level_number     1
+!!    t         time                   1
+!!
+!!-- Rule 4 : we look for a specific name
+!!
+!!  Axis   Names
+!!
+!!    x    'nav_lon' 'lon'    'longitude'
+!!    y    'nav_lat' 'lat'    'latitude'
+!!    z    'depth'   'deptht' 'height'      'level'
+!!         'lev'     'plev'   'sigma_level' 'layer'
+!!    t    'time'    'tstep'  'timesteps'
+!!
 !!--------------------------------------------------------------------
 !-
@@ -921,5 +932,5 @@
 !-
 ! Define "Conventions" global attribute
-  i_rc = NF90_PUT_ATT(f_e,NF90_GLOBAL,'Conventions',"CF-1.0")
+  i_rc = NF90_PUT_ATT(f_e,NF90_GLOBAL,'Conventions',"CF-1.1")
 !-
 ! Add the DOMAIN attributes if needed
@@ -1111,5 +1122,5 @@
  &                      nw_di(k_1,f_i),levid)
     i_rc = NF90_PUT_ATT(f_e,levid,"axis","Z")
-    i_rc = NF90_PUT_ATT(f_e,levid,'standard_name','level')
+    i_rc = NF90_PUT_ATT(f_e,levid,'standard_name','model_level_number')
     i_rc = NF90_PUT_ATT(f_e,levid,'units','sigma_level')
     i_rc = NF90_PUT_ATT(f_e,levid,'long_name','Sigma Levels')
@@ -4879,4 +4890,5 @@
   INTEGER :: kv,k,n_r,l_d,n_d,i_rc,dimnb
   CHARACTER(LEN=1)  :: c_ax
+  CHARACTER(LEN=9)  :: c_sn
   CHARACTER(LEN=15),DIMENSION(10) :: c_r
   CHARACTER(LEN=40) :: c_t1,c_t2
@@ -4899,69 +4911,18 @@
       CASE('x')
         l_d = 2
+        c_sn = 'longitude'
       CASE('y')
         l_d = 2
+        c_sn = 'latitude'
       CASE('z')
         l_d = 1
+        c_sn = 'model_level_number'
       CASE('t')
         l_d = 1
+        c_sn = 'time'
       END SELECT
 !---
-!-- Rule 1 : we look for a correct "axis" attribute
-!---
-    IF (i_v < 0) THEN
-      L_R1: DO kv=1,nw_nv(f_i)
-        i_rc = NF90_GET_ATT(nw_id(f_i),kv,'axis',c_t1)
-        IF (i_rc == NF90_NOERR) THEN
-          CALL strlowercase (c_t1)
-          IF (TRIM(c_t1) == c_ax) THEN
-            i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d)
-            IF (n_d <= l_d) THEN
-              i_v = kv; nbd = n_d;
-              EXIT L_R1
-            ENDIF
-          ENDIF
-        ENDIF
-      ENDDO L_R1
-    ENDIF
-!---
-!-- Rule 2 : we look for a specific name
-!---
-    IF (i_v < 0) THEN
-      SELECT CASE (c_ax)
-      CASE('x')
-        n_r = 3
-        c_r(1)='nav_lon'; c_r(2)='lon'; c_r(3)='longitude';
-      CASE('y')
-        n_r = 3
-        c_r(1)='nav_lat'; c_r(2)='lat'; c_r(3)='latitude';
-      CASE('z')
-        n_r = 8
-        c_r(1)='depth'; c_r(2)='deptht'; c_r(3)='height';
-        c_r(4)='level'; c_r(5)='lev'; c_r(6)='plev';
-        c_r(7)='sigma_level'; c_r(8)='layer';
-      CASE('t')
-        n_r = 3
-        c_r(1)='time'; c_r(2)='tstep'; c_r(3)='timesteps';
-      END SELECT
-!-----
-      L_R2: DO kv=1,nw_nv(f_i)
-        i_rc = NF90_INQUIRE_VARIABLE &
- &               (nw_id(f_i),kv,name=c_t1,ndims=n_d)
-        IF (i_rc == NF90_NOERR) THEN
-          CALL strlowercase (c_t1)
-          IF (n_d <= l_d) THEN
-            DO k=1,n_r
-              IF (TRIM(c_t1) == TRIM(c_r(k))) THEN
-                i_v = kv; nbd = n_d;
-                EXIT L_R2
-              ENDIF
-            ENDDO
-          ENDIF
-        ENDIF
-      ENDDO L_R2
-    ENDIF
-!---
-!-- Rule 3 : we look for a variable with one dimension
-!--          and which has the same name as its dimension
+!-- Rule 1 : we look for a variable with one dimension
+!--          and which has the same name as its dimension (NUG)
 !---
     IF (i_v < 0) THEN
@@ -4985,5 +4946,5 @@
       IF (i_rc == NF90_NOERR) THEN
         CALL strlowercase (c_t1)
-        L_R3: DO kv=1,nw_nv(f_i)
+        L_R1: DO kv=1,nw_nv(f_i)
           i_rc = NF90_INQUIRE_VARIABLE &
  &                 (nw_id(f_i),kv,name=c_t2,ndims=n_d)
@@ -4992,9 +4953,82 @@
             IF (TRIM(c_t1) == TRIM(c_t2)) THEN
               i_v = kv; nbd = n_d;
+              EXIT L_R1
+            ENDIF
+          ENDIF
+        ENDDO L_R1
+      ENDIF
+    ENDIF
+!---
+!-- Rule 2 : we look for a correct "axis" attribute (CF)
+!---
+    IF (i_v < 0) THEN
+      L_R2: DO kv=1,nw_nv(f_i)
+        i_rc = NF90_GET_ATT(nw_id(f_i),kv,'axis',c_t1)
+        IF (i_rc == NF90_NOERR) THEN
+          CALL strlowercase (c_t1)
+          IF (TRIM(c_t1) == c_ax) THEN
+            i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d)
+            IF (n_d <= l_d) THEN
+              i_v = kv; nbd = n_d;
+              EXIT L_R2
+            ENDIF
+          ENDIF
+        ENDIF
+      ENDDO L_R2
+    ENDIF
+!---
+!-- Rule 3 : we look for a correct "standard_name" attribute (CF)
+!---
+    IF (i_v < 0) THEN
+      L_R3: DO kv=1,nw_nv(f_i)
+        i_rc = NF90_GET_ATT(nw_id(f_i),kv,'standard_name',c_t1)
+        IF (i_rc == NF90_NOERR) THEN
+          CALL strlowercase (c_t1)
+          IF (TRIM(c_t1) == TRIM(c_sn)) THEN
+            i_rc = NF90_INQUIRE_VARIABLE(nw_id(f_i),kv,ndims=n_d)
+            IF (n_d <= l_d) THEN
+              i_v = kv; nbd = n_d;
               EXIT L_R3
             ENDIF
           ENDIF
-        ENDDO L_R3
-      ENDIF
+        ENDIF
+      ENDDO L_R3
+    ENDIF
+!---
+!-- Rule 4 : we look for a specific name (IOIPSL)
+!---
+    IF (i_v < 0) THEN
+      SELECT CASE (c_ax)
+      CASE('x')
+        n_r = 3
+        c_r(1)='nav_lon'; c_r(2)='lon'; c_r(3)='longitude';
+      CASE('y')
+        n_r = 3
+        c_r(1)='nav_lat'; c_r(2)='lat'; c_r(3)='latitude';
+      CASE('z')
+        n_r = 8
+        c_r(1)='depth'; c_r(2)='deptht'; c_r(3)='height';
+        c_r(4)='level'; c_r(5)='lev'; c_r(6)='plev';
+        c_r(7)='sigma_level'; c_r(8)='layer';
+      CASE('t')
+        n_r = 3
+        c_r(1)='time'; c_r(2)='tstep'; c_r(3)='timesteps';
+      END SELECT
+!-----
+      L_R4: DO kv=1,nw_nv(f_i)
+        i_rc = NF90_INQUIRE_VARIABLE &
+ &               (nw_id(f_i),kv,name=c_t1,ndims=n_d)
+        IF (i_rc == NF90_NOERR) THEN
+          CALL strlowercase (c_t1)
+          IF (n_d <= l_d) THEN
+            DO k=1,n_r
+              IF (TRIM(c_t1) == TRIM(c_r(k))) THEN
+                i_v = kv; nbd = n_d;
+                EXIT L_R4
+              ENDIF
+            ENDDO
+          ENDIF
+        ENDIF
+      ENDDO L_R4
     ENDIF
 !---
