[ncl-talk] bias when there are missing values in one of the dataset

Dennis Shea shea at ucar.edu
Mon Mar 13 08:02:42 MDT 2017


    v_obs = obs->tmax(:,::-1,:) ;reverse latitudes min-max
    v_rac =racmo->tmax          ; <=== has missing values

; make both grids have the same _FillValue structure
    vobs  = where(ismissing(v_rac), v_obs at _FillValue,  vobs)


===
Hopefully, the following gives a 'global' (overall) area weighted bias

; overall (global) bias;  w are the weights: cos(rad*lat); gau(lat), ...

   v_obs_mean  = wgt_areaave_Wrap(v_obs, w, 1.0, 0)
   v_rac_mean   = wgt_areaave_Wrap(v_rac, w, 1.0, 0)
   print(v_obs_mean)
   print(v_rac_mean)

   bias_global = v_rac - v_obs
   bias_global at long_name = "Area weighted Bias: v_rac - v_obs"
   bias_global at units = v_obs at units
   copy_VarCoords(v_obs_mean, bias_global)
   print(bias_global)

===
An alternative is to interpolate (fill-in) all the _FillValue. However, you
would have to proceed carefully.

Good Luck



On Mon, Mar 13, 2017 at 4:53 AM, Noelia otero <noeli1680 at gmail.com> wrote:

> Hi!
>
> I am having some problems when plotting biases between two datasets in
> those grids where one of the dataset has missing values. Here, a piece of
> my code:
>
>    ;Get seasonal values for observ and mod.
>     v_obs = obs->tmax(:,::-1,:) ;reverse latitudes min-max
>     v_rac =racmo->tmax
>   ; Seasonal average
>     ;obs
>     avgobs_seas=dim_avg_n(v_obs,0)
>     avgobs_seas!0 = "lat"
>     avgobs_seas!1 = "lon"
>     avgobs_seas&lat = lat
>     avgobs_seas&lon = lon
>    ; model
>     avgrac_seas =dim_avg_n(v_rac,0)
>     copy_VarAtts(avgobs_seas,avgrac_seas)
>     copy_VarCoords(avgobs_seas,avgrac_seas)
>
>    ;Bias models
>     brac=avgrac_seas -avgobs_seas ; bias between seasonal averages
>     copy_VarAtts(avgobs_seas,brac)
>     copy_VarCoords(avgobs_seas, brac)
>
> The variable avgrac_seas contains missing values in the last latitude, but
> not avgobs_seas.
> So, when I compute the bias (brac), I am seeing that brac has weird values
> for the last coordinate :
>
> print(brac(36,:))
>
> Variable: brac (subsection)
> Type: double
> Total Size: 384 bytes
>             48 values
> Number of Dimensions: 1
> Dimensions and sizes:   [48]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :  -32767
> (0)     -10271.61482711738
> (1)     -10271.85755532229
> (2)     -10272.11799386223
> (3)     -10272.37392089582
> .......................................................
>
> and finally , my plot looks wrong ...
> Any suggestion to solve this? Should I filter the missing values before?
>
> Many thanks in advance,
>
> Noelia
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20170313/5d397820/attachment.html 


More information about the ncl-talk mailing list