[Thread Prev][Thread Next][Index]

Re: [ferret_users] Ferret Array/variable class detection



Sorry to interrupt to once again, I have come up with one more problem, with ASN transformation

$ f
     NOAA/PMEL TMAP
     FERRET v6.842 
     Linux 2.6.32-279.19.1.el6.x86_64 32-bit - 02/01/13
     10-Dec-13 00:39    

yes? use m1.nc , m2.nc
yes? sh d
     currently SET data sets:
    1> ./m1.nc
 name     title                             I         J         K         L         M         N
 TUM_6    Latitude                         1:1       ...       ...       ...       ...       ...
 TUM_9    Date - String                    1:1       ...       ...       ...       ...       ...
 
    2> ./m2.nc  (default)
 name     title                             I         J         K         L         M         N
 TUM_6    Latitude                         1:1       ...       ...       ...       ...       ...
 TUM_9    Date - String                    1:1       ...       ...       ...       ...       ...
 
yes? sh g tum_6[d=1]
    GRID GSX1
 name       axis              # pts   start                end
 PROFILE_NO X                   1 r   1                    1
 normal    Y
 normal    Z
 normal    T
 normal    E
 normal    F

yes? sh g tum_6[d=2]
    GRID GSI1
 name       axis              # pts   start                end
 PROFILE_NO1 X                  1 r   2                    2
 normal    Y
 normal    Z
 normal    T
 normal    E
 normal    F

yes? define axis/x=1:2:1 xax

! default regridding
yes? let out1 = tum_6[d=1,gx=xax]

! asn for strings
yes? let out2 = tum_9[d=1,gx=xax@asn]
yes? list out1,out2
             X: 0.5 to 2.5
 Column  1: OUT1 is TUM_6[D=m1,GX=XAX]
 Column  2: OUT2 is TUM_9[D=m1,GX=XAX@ASN]
          OUT1       OUT2
1   / 1:  5.457 "24-JUN-2006"
2   / 2:   .... ""     
    
yes? list/file=merge.nc/format=cdf/clobber/ilimits=1:2/i=1 out1,out2
 LISTing to file merge.nc

yes? let out1 = tum_6[d=2,gx=xax]
yes? let out2 = tum_9[d=2,gx=xax@asn]
yes? list out1,out2
             X: 0.5 to 2.5
 Column  1: OUT1 is TUM_6[D=m2,GX=XAX]
 Column  2: OUT2 is TUM_9[D=m2,GX=XAX@ASN]
          OUT1       OUT2
1   / 1:   .... "24-JUN-2010"
2   / 2:  5.058 ""        
 
yes? list/file=merge.nc/format=cdf/append/i=2 out1,out2
 LISTing to file merge.nc

yes? use merge.nc
yes? sh d
     currently SET data sets:
    1> ./merge.nc  (default)
 name     title                             I         J         K         L         M         N
 OUT1     TUM_6[D=1,GX=XAX]                1:2       ...       ...       ...       ...       ...
 OUT2     TUM_9[D=1,GX=XAX@ASN]            1:2       ...       ...       ...       ...       ...
 
yes? list out1,out2
             DATA SET: ./merge.nc
             X: 0.5 to 2.5
 Column  1: OUT1 is TUM_6[D=1,GX=XAX]
 Column  2: OUT2 is TUM_9[D=1,GX=XAX@ASN]
          OUT1       OUT2
1   / 1:  5.457 "24-JUN-2006"
2   / 2:  5.058 ""    

What could be the solution for this ? whether anything went wrong in using asn transformation ?

-Akshay


On Mon, Dec 9, 2013 at 11:00 PM, Akshay Hegde <akshay.k.hegde@xxxxxxxxx> wrote:
Thanks a lot mam.

this will solve my problem.

-Akshay



On Mon, Dec 9, 2013 at 10:52 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Yes -

  `var,return=dtype`

will return FLOAT or CHAR.  Putting it into a symbol would likely give you the most flexibility to make use of it.


On 12/8/2013 8:54 PM, Akshay Hegde wrote:

Hi Developers,

Is there any function to check an array class ?

for example character classes defined by the POSIX standard

[[:alpha:]] --------> alphabetic characters

[[:alnum:]] -------> alphanumeric characters

[[:digit:]] ------> Numeric characters


[akshay@aix tmp]$ f
     NOAA/PMEL TMAP
     FERRET v6.85 
     Linux 2.6.18-371.1.2.el5 64-bit - 11/12/13
      9-Dec-13 09:58    

! Numbers
yes? let numerics = {1,2,3,4,5}

! Alpha
yes? let strings = {"1","2","3","4","5"}

yes? list numerics,strings
             X: 0.5 to 5.5
 Column  1: NUMERICS is {1,2,3,4,5}
 Column  2: STRINGS is {"1","2","3","4","5"}
       NUMERICS  STRINGS
1   / 1:   1.000 "1"
2   / 2:   2.000 "2"
3   / 3:   3.000 "3"
4   / 4:   4.000 "4"
5   / 5:   5.000 "5"

yes? list/file=tester.nc/format=cdf/clobber numerics,strings
 LISTing to file tester.nc

yes? can var/all

yes? use tester.nc

yes? sh d
     currently SET data sets:
    1> ./tester.nc  (default)
 name     title                             I         J         K         L         M         N
 NUMERICS {1,2,3,4,5}                      1:5       ...       ...       ...       ...       ...
 STRINGS  {"1","2","3","4","5"}            1:5       ...       ...       ...       ...       ...
 
yes? list numerics,strings
             DATA SET: ./tester.nc
             X: 0.5 to 5.5
 Column  1: NUMERICS is {1,2,3,4,5}
 Column  2: STRINGS is {"1","2","3","4","5"}
       NUMERICS  STRINGS
1   / 1:   1.000 "1"
2   / 2:   2.000 "2"
3   / 3:   3.000 "3"
4   / 4:   4.000 "4"
5   / 5:   5.000 "5"

yes? list ..varnames
             VARIABLE : ..VARNAMES
             FILENAME : tester.nc
             SUBSET   : 2 points (X)
 1   / 1:"NUMERICS"
 2   / 2:"STRINGS"


Here I want to create one array say let mask that should contain 0 if ..varnames is numeric class and 1 if its string class (alphanumeric)

I am interested to know how ferret checks internally whether an array is of string class or numeric class ? while displaying this error message "string/numeric data type mix-up"

yes? let myvar = ..varnames
yes? list myvar
             VARIABLE : ..VARNAMES
             FILENAME : tester.nc
             SUBSET   : 2 points (X)
 1   / 1:"NUMERICS"
 2   / 2:"STRINGS"

I need to create mask, so that if I list myvar and mask, I should get following result

Expected result :

 list myvar,myvar
             DATA SET: ./tester.nc
 Column  1: MYVAR is ..VARNAMES
 Column  2: mask is some expre
             MYVAR     mask
1   / 1: "NUMERICS" 0
2   / 2: "STRINGS"   1

 
Thanks and Regards,
Akshay Hegde
CSIR-National Institute of Oceanography,
Dona Paula, Panjim, Goa -403004








Attachment: m1.nc
Description: Cdf file

Attachment: m2.nc
Description: Cdf file

Attachment: merge.nc
Description: Cdf file


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement