area weighted average

From: Marston Johnston <shejo284_at_nyahnyahspammersnyahnyah>
Date: Sun Jun 16 2013 - 04:43:46 MDT

Hi,

Just want to update this problem.

I've changed the call to mask and tried to mask the correct region:

function Atlantic(tp:numeric,nbin:integer)

  begin

  print("Setuping Atlantic region arrays....")

  latMin = -7

  latMax = 25

  lonMin = 310

  lonMax = 350

  tp = mask (tp, conform(tp, (tp@lat2d.ge.latMin .and. \

                              tp@lat2d.le.latMax .and. \

                              tp@lon2d.ge.lonMin .and. \

                              tp@lon2d.le.lonMax), (/1,2/)), True)

  printVarSummary(tp)

  latwgt = latRegWgt(tp@lat, "float", 0)

  atlantic = ndtooned(tp) ; convert to 1D

  areaAve = wgt_areaave(tp, latwgt, 1.0, 1)

  ;print("Area Average "+areaAve)

  exit

  pdf = pdfx(atlantic,nbin,False)

  pdf = where(pdf.ne.0,pdf,pdf@_FillValue)

  return(pdf)

end

resulted in:
ncl total_rr_stats_regions.ncl
 Copyright (C) 1995-2012 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.1.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
(0) Extracting the total precip arrays...
(0) Opening file ECHAM6_regridded_1x1_2007-2008.nc...
(0)
(0) min=4.71418e-15 max=25.8996

Variable: tp
Type: float
Total Size: 682110720 bytes
            170527680 values
Number of Dimensions: 3
Dimensions and sizes: [time | 5848] x [lat | 81] x [lon | 360]
Coordinates:
Number Of Attributes: 2
  zAvgTime : <ARRAY of 29160 elements>
  _FillValue : 9.96921e+36
(0) Setuping Atlantic region arrays....

Variable: tp (parameter)
Type: float
Total Size: 682110720 bytes
            170527680 values
Number of Dimensions: 3
Dimensions and sizes: [time | 5848] x [lat | 81] x [lon | 360]
Coordinates:
Number Of Attributes: 6
  _FillValue : 9.96921e+36
  zAvgTime : <ARRAY of 29160 elements>
  lat : <ARRAY of 81 elements>
  lon : <ARRAY of 360 elements>
  lat2d : <ARRAY of 29160 elements>
  lon2d : <ARRAY of 29160 elements>
warning:Dimension (0) has not been defined
.
.
.5835) Area Average 9.96921e+36
(5836) Area Average 9.96921e+36
(5837) Area Average 9.96921e+36
(5838) Area Average 9.96921e+36
(5839) Area Average 9.96921e+36
(5840) Area Average 9.96921e+36
(5841) Area Average 9.96921e+36
(5842) Area Average 9.96921e+36
(5843) Area Average 9.96921e+36
(5844) Area Average 9.96921e+36
(5845) Area Average 9.96921e+36
(5846) Area Average 9.96921e+36
(5847) Area Average 9.96921e+36
[sm_marst@a6 ncl_codes]$

/M

-- 
Only the fruitful thing is true!

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jun 16 04:44:01 2013

This archive was generated by hypermail 2.1.8 : Mon Jun 24 2013 - 11:46:47 MDT