Re: month_to_season with missing data

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed, 07 Jun 2006 16:13:11 -0600

Hi Jeff,

After taking a close look at the month_to_season code it turns out that
the problem is on our end. month_to_season and month_to_seasonN
currently will incorrectly return and array that has all the missing
data set to -999, and not = to the _FillValue attribute. To remedy this,
after calling month_to_season do the following:
tavgDJF@_FillValue = -999.
tavgDJF@_FillValue = 1e20

This bug will be fixed in the next release of NCL, due out later this
summer. Let me know if you have any other questions about this...
Adam

Jeff Van Dorn wrote:
> Hi Adam,
>
> Thanks for the suggestion, but still having the same issue. FWIW, if I
> just move my area of interest to an area that doesn't have any missing
> values, the plots come out fine (with or without using dim_avg_Wrap).
> Here's what I'm doing:
>
> f = addfile (diri+fili, "r")
> time = f->time
> tavg = f->Tavg
> lat = f->latitude
> lon = f->longitude
> tavg@_FillValue=1e20
>
> tavg_ts = tavg( time | 12:371, latitude | 89:189, longitude | 349:461)
> tavgDJF = month_to_season( tavg_ts, "DJF" )
> tavgDJF_avg = (dim_avg_Wrap(tavgDJF(latitude|:,longitude|:,time|:)) )
> (set resources and such...then)
> map = gsn_csm_contour_map_ce(wks,tavgDJF_avg, res)
>
> I'm guessing there's something else I'm doing incorrectly, anything
> jump out at you?
> Thanks
> Jeff
>
> Here's what tavgDJF_avg looks like now:
> Variable: tavgDJF_avg
> Type: float
> Total Size: 45652 bytes
> 11413 values
> Number of Dimensions: 2
> Dimensions and sizes: [latitude | 101] x [longitude | 113]
> Coordinates:
> latitude: [36.3125..48.8125]
> longitude: [-81.0625..-67.0625]
> Number Of Attributes: 7
> NMO : 0
> _FillValue : 1e+20
> axis : TYX
> units : C
> associate : time latitude longitude
> missing_value : 1e+20
> average_op_ncl : dim_avg over dimension: time
>
> On Jun 7, 2006, at 4:13 PM, Adam Phillips wrote:
>
>> Hi Jeff,
>>
>> By including the (/ /) around the dim_avg function:
>>
>> tavgDJF_avg = (/dim_avg(tavgDJF(latitude|:,longitude|:,time|:)) /)
>>
>> you are telling NCL to not transfer any metadata to the left-hand
>> side of the equal sign (_FillValue's are set correctly on the left-
>> hand side of the equation though.). Thus, latitude and longitude
>> information are not included as coordinate variables in tavgDJF.
>> (This can be seen in your printVarSummary.) You would be getting
>> error messages when you plot this array though...
>>
>> I would suggest using dim_avg_Wrap instead of dim_avg: http://
>> www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_Wrap.shtml
>>
>> as the coordinate variable info along with attributes are passed to
>> resulting array. Try using dim_avg_Wrap and see if anything changes.
>>
>> Let us know if this doesn't solve your problem..
>> Adam
>>
>> Jeff Van Dorn wrote:
>>
>>> Apologies if this has been covered before, I didn't see it in the
>>> documentation or in my searching.
>>> I'm trying to produce some seasonal average plots with a netCDF
>>> file that doesn't contain data over the ocean or in Canada, yet
>>> they are in the area that I'm interested in (the upper Northeast US).
>>> I'm able to successfully plot the netCDF file when I issue:
>>> "tavg@_FillValue=1e20", and the missing data areas then have no
>>> color to them, which is cool. However, when I try to do my
>>> seasonal averages, via:
>>> tavg_ts = tavg( time | 12:371, latitude | 89:189, longitude |
>>> 349:461)
>>> tavgDJF = month_to_season( tavg_ts, "DJF" )
>>> tavgDJF_avg = (/dim_avg(tavgDJF(latitude|:,longitude|:,time|:)) /)
>>> it really seems like the missing data isn't being ignored, as I get
>>> data (certainly invalid data) over the oceans and Canada. When I
>>> do a printVarSummary, tavgDJF_avg does contain that proper
>>> FillValue for the missing data:
>>> Variable: tavgSON2070_avg
>>> Type: float
>>> Total Size: 45652 bytes
>>> 11413 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [101] x [113]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : 1e+20
>>> So, do I have to compute my seasonal means in a different manner,
>>> or am doing something wrong above?
>>> Thanks for any help.
>>> Jeff Van Dorn
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> --------------------------------------------------------------
>> Adam Phillips asphilli_at_ucar.edu
>> National Center for Atmospheric Research tel: (303) 497-1726
>> ESSL/CGD/CAS fax: (303) 497-1333
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 07 2006 - 16:13:11 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 08 2006 - 13:13:21 MDT