Re: missing values

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 04 2013 - 16:32:22 MST

Rafael,

Thanks for providing the script and data offline.

The issue is that you are setting the last argument of wgt_areaave to "1". The
documentation states that if you set this to 1, *and* your input array contains
any missing values, then you will get a missing value returned.

------
http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml

If opt = 0, the area average is calculated using available non-missing data. If opt = 1, then if any point in q is missing, the area average is not computed. In this case, it will be set to the missing value, which is indicated by q@_FillValue, or the default missing value if q@_FillValue is not set.
-----

If you set this last argument to 0, then you get a value for Ave:

Variable: Ave
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0) 4.533181

--Mary

On Jan 4, 2013, at 2:52 PM, rafael dido wrote:

> Yes, I did and produced the same result: -999,
> ok, here is the simple test for that:
>
> begin
>
> f = addfile("/projekt1/precip_ocean.nc","r")
> pocean = f->psea(:,{-10:10},:)
> lat = f->lat({-10:10})
> pocean@_FillValue = pocean@missing_value
> pocean@_FillValue = -999
> printVarSummary(pocean)
>
> ocean = dim_avg_Wrap( pocean(lat|:, lon|:, time|:) )
> printVarSummary(ocean)
>
> rad = 4.0*atan(1.0)/180.0
> clat = cos(lat*rad)
> Ave = wgt_areaave(ocean, clat, 1.0, 1) ;ocean
> print ("Areal Average")
> print(Ave)
>
> end
>
> ==== Output====
>
> Variable: pocean
> Type: float
> Total Size: 132541920 bytes
> 33135480 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 4383] x [lat | 21] x [lon | 360]
> Coordinates:
> time: [8760..113928]
> lat: [ -10.. 10]
> lon: [ 0.. 359]
> Number Of Attributes: 3
> missing_value : -1e+34
> _FillValue : -999
>
> Variable: ocean
> Type: float
> Total Size: 30240 bytes
> 7560 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 21] x [lon | 360]
> Coordinates:
> lat: [ -10.. 10]
> lon: [ 0.. 359]
> Number Of Attributes: 4
> _FillValue : -999
> missing_value : -1e+34
> average_op_ncl : dim_avg over dimension(s): time
>
> (0) Areal Average
>
>
> Variable: Ave
> Type: float
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
> (0) -999
>
>
>
> Thanks
> Rafael
>
>
>
> On Sat, Jan 5, 2013 at 6:36 AM, Dennis Shea <shea@ucar.edu> wrote:
> Did you do:
> clat = cos(ocean&lat*rad)
> ^^^^^^^^^
>
>
> On 1/4/13 2:32 PM, rafael dido wrote:
> Thanks for the response:
>
> Yes, i created lat in another line for different dataset (total precip,
> without masking). Ok, i will send the code, but the size is quite large ~
> 1.1 Gb. I will try again here. If in the end I am still not able figure out
> this matter, I will cut some of time steps and send the small data to ftp.
>
> Mary, here is the information:
>
> Variable: pocean
> Type: float
> Total Size: 132541920 bytes
> 33135480 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 4383] x [lat | 21] x [lon | 360]
> Coordinates:
> time: [8760..113928]
> lat: [ -10.. 10]
> lon: [ 0.. 359]
> Number Of Attributes: 3
> missing_value : -1e+34
> _FillValue : -1e+34
> ncl 26> print("min/max pocean = " + min(pocean) + "/" + max(pocean))
> *(0) min/max pocean = 0/560.664 ------> I guess it's realitic value and Ok.
>
> *
>
> I just wonder, why the plot is just fine but the areal average is incorrect.
> Thank you.
>
>
> Rafael.
>
>
>
>
>
>
>
>
> On Sat, Jan 5, 2013 at 5:54 AM, Mary Haley <haley@ucar.edu> wrote:
>
> Rafael,
>
> If you are getting one single missing value, then something is likely
> wrong with the data you are passing in.
>
> Did you look at pocean to make sure it is okay?
>
> printVarSummary(pocean)
> print("min/max pocean = " + min(pocean) + "/" + max(pocean))
>
> --Mary
>
> On Jan 4, 2013, at 12:41 PM, rafael dido wrote:
>
> Hallo NCL Users,
>
> Thanks for the response,
>
> I meant, why did the result of the areal average either for land masking
> or ocean masking in this case (precipitation over the ocean or land)
> is equal to -999. I noticed in the previous email the the print value for
> "ave" which is an areal average for sea is equal to missing value.
>
> What should i do thus i will obtain the real value of this calculation.
>
> my code
> [snip]
>
> f = addfile("/projekt1/precip_ocean.nc","r") ; Read in first time
> step and
> pocean = f->psea(:,{-10:10},:)
> pocean@_FillValue = pocean@missing_value
> pocean@_FillValue = -999
> printVarSummary(pocean)
>
> rad = 4.0*atan(1.0)/180.0
> clat = cos(lat*rad)
> ocean = dim_avg_Wrap( pocean(lat|:, lon|:, time|:) )
> Ave = wgt_areaave(ocean, clat, 1.0, 1)
> print(ave)
>
> [snip]
>
> --------------------------Result-------------------
> Variable: Ave
> Type: float
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
> *(0) -999 <------------------------------Areal Average of
> precipitation over the Ocean*
>
>
>
> Thanks,
> Rafael
>
>
>
>
>
>
>
>
>
>
> On Sat, Jan 5, 2013 at 3:57 AM, Mary Haley <haley@ucar.edu> wrote:
>
> Rafael,
>
> I'm not sure what the problem is. Do you mean that you don't want a
> _FillValue of -999?
>
> If so, then in your script, you changed the _FillValue attribute to have a
> value of -999, which means when you take the average, it will also
> have a _FillValue attribute of -999.
>
> If you don't want -999 as a _FillValue, then remove this line:
>
>
> pocean@_FillValue = -999
>
>
> --Mary
>
>
> On Jan 4, 2013, at 10:49 AM, rafael dido wrote:
>
> Hi NCL,
>
> I have nc file containing missing value indicated by "_"
>
> dimensions:
> lon = 360 ;
> lat = 181 ;
> time = UNLIMITED ; // (4383 currently)
> variables:
> double lon(lon) ;
> lon:units = "degrees_east" ;
> lon:modulo = 360. ;
> lon:point_spacing = "even" ;
> lon:axis = "X" ;
> double lat(lat) ;
> lat:units = "degrees_north" ;
> lat:point_spacing = "even" ;
> lat:axis = "Y" ;
> double time(time) ;
> time:units = "hours since 1997-01-01 00:00:00" ;
> time:time_origin = "01-JAN-1997 00:00:00" ;
> time:axis = "T" ;
> float psea(time, lat, lon) ;
> * **psea:missing_value = -1.e+34f ;*
> * psea:_FillValue = -1.e+34f ;*
> // global attributes:
> :Conventions = "CF-1.0" ;
> data:
>
> psea =
> _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
> _,
> _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
> _,
> 0.02250607, 0.5173603, 0, 0, 0, 0, 0, 0, 0, 0.01500405, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0,
> _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
> _,
> _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 0, 0, 0.4348826,
> 0.05248583,
> 3.899931, 24.72732, 53.44849, 21.48183, 11.3707, 3.757559, 0.0299919,
>
> [SNIP]
>
> Once, I calculated the average for a specific domain i got the result is
> -999 as
> i set my command as follow:
>
> f = addfile("/projekt1/precip_ocean.nc","r") ; Read in first time
> step and
> pocean = f->psea(:,{-10:10},:)
> pocean@_FillValue = pocean@missing_value
> pocean@_FillValue = -999
> printVarSummary(pocean)
>
> rad = 4.0*atan(1.0)/180.0
> clat = cos(lat*rad)
> ocean = dim_avg_Wrap( pocean(lat|:, lon|:, time|:) )
> Ave = wgt_areaave(ocean, clat, 1.0, 1)
> print(ave)
>
> === [executed]
> Variable: Ave
> Type: float
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
> *(0) -999*
>
>
>
> Is there any hints how to handle this problem in NCL? When I used another
> language program,
> and I do not get any problem to calculate this average.
>
>
> Thanks
>
> RF.
>
>
> _______________________________________________
> 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
>
>
>
>
>
>
> _______________________________________________
> 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 Fri Jan 4 16:32:35 2013

This archive was generated by hypermail 2.1.8 : Mon Jan 07 2013 - 08:57:08 MST