Re: How to check and fill the missing days?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 06 2012 - 08:43:18 MDT

Shawn,

You can remove any lines in your strings that contain "STN----" with:

;---Replace all lines with "STN" with a missing value
  lines(str_match_ind(lines,"STN")) = lines@_FillValue

;---Grab only the lines that are not missing (ie the lines that contain data)
  data_lines = lines(ind(.not.ismissing(lines)))

Now you are only working with lines that actually contain data, and the script should work again.
You may need to set some more missing value attributes, though (@_FillValue).

Also, in the str_get_fields lines, don't forget to replace "lines(1:)" with "data_lines".

--Mary

On Sep 4, 2012, at 4:52 PM, Wen.J.Qu wrote:

> Hi, Mary,
>
> Thanks for your execllet code. That works quite well to fill the missing days.
>
> However, when I move to deal with the attached file which is the result of cat the multi-years ASCII files for one station, it has some problem. I know that it is the header lines from other years resuted in the extra header lines within the attached file, which leads to problem to execute the code.
>
> I have worked on this for a long while, but still can not make it out. Would you please help me with this? Thank you so much.
>
> All my best!
>
>
> Shawn
>
> Wen.J.Qu
> 2012-09-04
> 发件人: Mary Haley
> 发送时间: 2012-08-24 18:30:34
> 收件人: Wen.J.Qu@gmail.com
> 抄送: ncl-talk
> 主题: Re: [ncl-talk] How to check and fill the missing lines with the missing values?
>
> Shawn,
>
> See the attached file.
>
> I pretty much use str_get_field (and not str_get_cols) to read in all your data. I do use "str_get_cols" to parse the yyyymmdd array into yyyy and mm.
>
> This function also creates a new yyyymmdd array that doesn't contain any missing days, and then creates 15 new arrays (for your 15 other fields) that are the same size, with the appropriate indexes filled in.
> <read_and_fill.ncl><543860-99999-7310.op>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 6 08:44:14 2012

This archive was generated by hypermail 2.1.8 : Tue Sep 11 2012 - 15:30:42 MDT