[ncl-talk] Problem with str_match

Wei Huang huangwei at ucar.edu
Mon Mar 9 11:32:47 MDT 2015


Stephane,

For your first question, sorry we do not have a different version (using
regex) around.
The second one is a hard question. Yes, we try pretty hard to maintain
backward compatible,
and as you can see, most of NCL functions are, but that is not always the
case.
Like here str_match is one of them.

As I said, str_match was developed using regex, then there were quite few
issues with it,
and we switched to plain character string match. it solved some issues,
then caused some
new one, like the ones Sophie (and probably you) got, and certainly the
backward compatible
issues as those two schemes functioning pretty different.

Let say this, we will have a NCL group meeting tomorrow. Let me rise this
issue at our group
meeting, and discuss what we should handle this issue and then come back to
you.

At this point, if you have any comments/suggestions/requirements, please
let us know, so we can
discuss it. Certainly we welcome other people chip-in their ideas as well.

Thanks,

Wei

================================================
1850 Table Mesa Dr.
Boulder, CO 80307
Phone: 303-497-8924

On Mon, Mar 9, 2015 at 10:28 AM, SENESI Stéphane <stephane.senesi at meteo.fr>
wrote:

> Hi  Wei Huang
>
> Is there an new function that would match the old behaviour  of str_match ?
> Is there any commitment from NCL on backward compatibility on basic
> functions?
>
> Best regards
>
> S
>
> ------------------------------
>
> *De: *"TYTECA Sophie" <sophie.tyteca at meteo.fr>
> *À: *"SENESI Stéphane" <stephane.senesi at meteo.fr>
> *Envoyé: *Lundi 9 Mars 2015 17:01:19
> *Objet: *Fwd: [ncl-talk] Problem with str_match
>
> Voici l'explication,  mais cela ne nous arrange pas!
>
> ----- Météo-France -----
> TYTECA SOPHIE
> CNRM/GMGEC/VDR
> sophie.tyteca at meteo.fr
> Fixe : +33 561079379
> ------------------------------
> *De: *"Wei Huang" <huangwei at ucar.edu>
> *À: *"TYTECA Sophie" <sophie.tyteca at meteo.fr>
> *Cc: *ncl-talk at ucar.edu
> *Envoyé: *Lundi 9 Mars 2015 16:40:46
> *Objet: *Re: [ncl-talk] Problem with str_match
>
>
> Sophie,
>
> In the earlier version, NCL used regex for string match, which is why it
> worked there.
> The current version, NCL has switched to character match, which is why it
> failed there.
>
> Here is a short code (based on your case) on how to use NCL str_match.
>
> ;NCL does not support regex string match/compare, the following code will
> return missing.
>  varname="rntcre"
>  a=str_match(varname,"r[lsn][ats]cre")
>  print (a)
>
> ;NCL supports plain character string match, the following code will return
> the match.
>  b=str_match(varname,"ntcre")
>  print (b)
> ------------------------
> Here is the print out from the code above.
> -------------------------------
> Variable: a
> Type: string
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :  missing
> (0)     missing
>
>
> Variable: b
> Type: string
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> (0)     rntcre
>
>
> Please let ncl-talk know if there is anything can help.
>
> Wei
>
>
> ================================================
> 1850 Table Mesa Dr.
> Boulder, CO 80307
> Phone: 303-497-8924
>
> On Mon, Mar 9, 2015 at 9:27 AM, TYTECA Sophie <sophie.tyteca at meteo.fr>
> wrote:
>
>> Hello,
>>
>> I have a problem with str_match function and the NCL last version .
>> the result gives "missing" in my string
>>
>> Here my machine: Linux x86_64 GNU/Linux
>>
>> *ncl*
>>  Copyright (C) 1995-2014 - All Rights Reserved
>>  University Corporation for Atmospheric Research
>>  NCAR Command Language *Version 6.2.1*
>>  The use of this software is governed by a License Agreement.
>>  See http://www.ncl.ucar.edu/ for more details.
>> *ncl 0> varname="rntcre"*
>> *ncl 1> a=str_match(varname,"r[lsn][ats]cre")*
>> *ncl 2> print (a)*
>>
>> Variable: a
>> Type: string
>> Total Size: 8 bytes
>>             1 values
>> Number of Dimensions: 1
>> Dimensions and sizes:    [1]
>> Coordinates:
>> Number Of Attributes: 1
>>   _FillValue :    missing
>> (0)    missing
>>
>> this function works with NCL previous version:
>>
>> *ncl*
>>  Copyright (C) 1995-2012 - All Rights Reserved
>>  University Corporation for Atmospheric Research
>>  NCAR Command Language *Version 6.1.0*
>>  The use of this software is governed by a License Agreement.
>>  See http://www.ncl.ucar.edu/ for more details.
>> *ncl 0> varname="rntcre"*
>> *ncl 1> a=str_match(varname,"r[lsn][ats]cre")*
>> *ncl 2> print (a)*
>>
>> Variable: a
>> Type: string
>> Total Size: 8 bytes
>>             1 values
>> Number of Dimensions: 1
>> Dimensions and sizes:    [1]
>> Coordinates:
>> (0)    rntcre
>>
>> Could you help me, please?
>> Thank you very much
>>
>> ----- Météo-France -----
>> TYTECA SOPHIE
>> CNRM/GMGEC/VDR
>> sophie.tyteca at meteo.fr
>> Fixe : +33 561079379
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
>
>
> --
> ----- Météo-France -----
> SENESI STEPHANE
> CNRM/GMGEC/ASTER
> stephane.senesi at meteo.fr
> Fixe : +33 561079931
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150309/95c0dc3c/attachment.html 


More information about the ncl-talk mailing list