[ncl-talk] WRAPIT and _FillValue

Dennis Shea shea at ucar.edu
Mon Sep 15 18:29:08 MDT 2014


[1]  Tk has _FillValue=1d36 ... you do not need 'where', just

      tk at _FillValue = -999.0d0    ; change _FillValue [all 1d39 => -999.0]

      Under the hood, the above basically does

       Tk = where(ismissing(Tk),-999.d,Tk)

[2]
I'd do the whole thing in fortran ... (here f77) ... maybe som

       tc = new( (/ntim,nlat,mlon/), typeof(tk), valuec)

NCLFORTSTART
      subroutine spitoutx(ntim,nlat,mlon,valuek,tk,valuec,tc)
      implicit none
C                                                  ! INPUT
      integer ntim,nlat,mlon
      double precision tk(mlon,nlat,ntim), valuek, valuec
C                                                  ! OUTPUT
      double precision tc(mlon,nlat,ntim)
C                                                  ! LOCAL
      integer  nt, nl, ml

      do nt=0,ntim-1
         do nl=0,nlat-1
            do ml=0,mlon-1

                 tc(ml,nl,ny) = valuec
                 if (tk.ne.valuek) then
                     call spitout(tk(ml,nl,nt), tc(ml,nl,nt),
)
                 end if

            end do
         end do
     end do

On Mon, Sep 15, 2014 at 12:54 PM, jbuzan <jbuzan at purdue.edu> wrote:

> Hi ncl-talk,
>
> I am working a lot with WRAPIT, and the datasets that I am using have a
> lot of _FillValues.  I am jumping through hoops and it is really slowing my
> through put down.
> The Fortran Code is designed for single grid cells, so I am using ncl
> loops and an IF THEN statement.
>
> for example:
> value = 1d36
> delete(Tk at _FillValue)
> Tk = where(Tk.eq.1d36,-999.d,Tk)
>>       do k = 0, dimsizes(timet)-1
>          if (Tk(k,i,j).eq.-999.d) then
>             Tc(k,i,j) = value
>          else
>             SPITITOUT::spitout(Tk(k,i,j), Tc(k,i,j))
>          end if
>       end do
>> Tc at _FillValue = value
>
>
> Is there a better way to deal with _FillValues?
>
> Thanks,
>
> -Jonathan
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140915/037e9fe5/attachment.html 


More information about the ncl-talk mailing list