[ncl-talk] Sub: Station data.

Karin Meier-Fleischer meier-fleischer at dkrz.de
Tue Mar 24 03:37:27 MDT 2015


Hi Adv,

if you use the new version of ncl 6.3.0 than you can write the wanted 
data to a new string array using str_match_ic_regex:

   seldata = str_match_ic_regex(strs,"CROSBY ND US")         ;-- NEW  
available in version 6.3.0and later
   print(seldata)

--->

Variable: seldata
Type: string
Total Size: 8024 bytes
             1003 values
Number of Dimensions: 1
Dimensions and sizes:    [1003]
Coordinates:
Number Of Attributes: 1
   _FillValue :    missing
(0)    COOP:321871,CROSBY ND 
US,193101,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,10,-9999,-9999,12,12,41,-18,288,103,196
(1)    COOP:321871,CROSBY ND 
US,193102,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,2,-9999,-9999,4,4,40,-8,301,181,241
(2)    COOP:321871,CROSBY ND 
US,193103,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,25,-9999,-9999,99,50,50,-11,298,131,214
(3)    COOP:321871,CROSBY ND 
US,193104,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,0,-9999,-9999,0,0,83,12,578,293,436
(4)    COOP:321871,CROSBY ND 
US,193201,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,26,-9999,-9999,51,51,42,-28,168,-19,74
(5)    COOP:321871,CROSBY ND 
US,193202,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,40,-9999,-9999,52,60,66,-18,249,16,132
(6)    COOP:321871,CROSBY ND 
US,193203,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,20,-9999,-9999,50,50,51,-23,279,80,180
(7)    COOP:321871,CROSBY ND 
US,193204,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,73,-9999,-9999,115,5,72,20,534,308,421
(8)    COOP:321871,CROSBY ND 
US,193205,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,29,-9999,-9999,58,0,90,29,687,410,548
(9)    COOP:321871,CROSBY ND 
US,193206,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,249,-9999,-9999,594,0,87,47,759,544,652
(10)    COOP:321871,CROSBY ND 
US,193207,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,79,-9999,-9999,199,0,98,43,826,543,684
.....

Bye,
Karin


Am 24.03.15 um 03:54 schrieb Adv:
> Hi Ncl users,
> This is how my code look like. I would like to extract data 
> corresponding to station name and plot spatially only over North 
> Dakota region. Could some one help me to accomplish this by extracting 
> the data for different variables. I have attached the input csv file 
> with this mail. I have many csv files like this. I just wanna loop in 
> such a way all data can be processed at once.
> Thanks,
> Adv
>
> begin
>   flnm = "479615.csv"
>  strs = asciiread(flnm,-1,"string")
> ;print(strs)
> split_lines = str_split_csv(strs,",",2)
>   nlines  = dimsizes(split_lines(:,0))
>   nfields = dimsizes(split_lines(0,:))
>  header = split_lines(0,:)
> do n=0,nlines-1
>       tf = isStrSubset(strs(n), "CROSBY ND US")
>       if (tf) then
>       field=(strs(n))
>     do nf=0,nfields-1
>       print(header(nf) + " : " + str_join(split_lines(n,nf),", "))
>     end do
>       end if
> end do
> return
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Dipl. Geophys. Karin Meier-Fleischer
Visualization
Application Support

Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a - D20146 Hamburg - Germany

Phone:    +49 (0)40 460094 126
Fax:      +49 (0)40 460094 270
E-Mail:   meier-fleischer at dkrz.de
URL:      www.dkrz.de

Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150324/844e5958/attachment.html 


More information about the ncl-talk mailing list