triple2grid: variable values are missing after using function?

From: B N <gkhan100_at_nyahnyahspammersnyahnyah>
Date: Thu, 11 Jun 2009 14:25:26 -0400

Hi. NCL beginner here. I have spent an enormous amount of time going
through beginner lessons to use NCL for my research. I like it.
Unfortunately, I've encountered my first error that I can't figure
out. I have searched previous posts
and I don't see that others have encountered
this with triple2grid. I don't see any.

I use the triple2grid function to regrid 1/4 degree precipitation data
(CMORPH) to a 1/2 degree grid (ncl 59>, below). After I regrid the
data, my data is missing. I don't know why.
ncl 62> printMinMax(rNEW,True)
(0)
(0) min=-999 max=-999

Could I have some help with understanding this?
Thank you for your time.
-Bold Khan

Fu School of Engineering,
Earth and Environmental Engineering
Columbia University

mongol :CMORPH gkhan$ ncl
 Copyright (C) 1995-2009 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.1.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
ncl 5> a = addfile("cmorph_SOP3_.25nc","r")
ncl 6> rain_new = a->p_rate
ncl 7> rain_new=rain_new(:,::-1,:)
ncl 8> printVarSummary(rain_new)

Variable: rain_new
Type: float
Total Size: 663552000 bytes
          165888000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 240] x [lat | 480] x [lon | 1440]
Coordinates:
          time: [2.00609e+09..2.006093e+09]
          lat: [-59.875..59.875]
          lon: [0.125..359.875]
Number Of Attributes: 3
 units : mm/hr
 long_name : CMORPH
 _FillValue : -9999
ncl 9> printMinMax(rain_new,True)
(0)

(0) CMORPH: min=0 max=40.3708
ncl 10> nlat = 480
ncl 11> mlon = 1440
ncl 12> time = ispan(1,dimsizes(rain_new(:,0,0)),1)
ncl 13> lat = rain_new(0,:,0)
ncl 14> lon = rain_new(0,0,:)
ncl 15> lat!0 = "lat"
ncl 16> lat&lat = lat
ncl 17> lat_at_units = "degrees_north"
ncl 18> lon!0 = "lon"
ncl 19> lon&lon = lon
ncl 20> lon_at_units = "degrees_east"
ncl 21> ylat = lat
ncl 22> xlon = lon
ncl 23> ylat!0 = "Lat"
ncl 24> xlon!0 = "Lon"
ncl 25> lat2d = new((/480,1440/),float) ; CMORPH documentation
ncl 26> lon2d = new((/480,1440/),float)
ncl 27> lat2d!0 = "Lat"
ncl 28> lat2d!1 = "Lon"
ncl 29> lon2d!0 = "Lat"
ncl 30> lon2d!1 = "Lon"
ncl 31> lat2d_at_units = "degrees_north"
ncl 32> lon2d_at_units = "degrees_east"
ncl 33> ;=============; 2d grid coordinates should match the rain array.
ncl 34> do i=0,479
ncl 35> lon2d(i,:) = xlon(:)
ncl 36> end do
ncl 37> do i=0,1439
ncl 38> lat2d(:,i) = ylat(:)
ncl 39> end do
ncl 40> NLAT = 240
ncl 41> MLON = 720
ncl 42> Lat = fspan(59.875,-59.875,240) ; lat for regridding to 0.5 degree
ncl 43> Lon = fspan(0.125,359.875,720) ; lon for regridding to 0.5 degree
ncl 44> Lat!0 = "lat"
ncl 45> Lat_at_units = "degrees_north"
ncl 46> Lat&lat = Lat
ncl 47> Lon!0 = "lon"
ncl 48> Lon_at_units = "degrees_east"
ncl 49> Lon&lon = Lon
ncl 50> rNEW = new
((/dimsizes(rain_new(:,0,0)),NLAT,MLON/),typeof(rain_new),getFillValue(rain_new))
 ;New rain array
ncl 51> rNEW!0 = "time"
ncl 52> rNEW&time = time
ncl 53> rNEW!1 = "lat"
ncl 54> rNEW&lat = Lat
ncl 55> rNEW!2 = "lon"
ncl 56> rNEW&lon = Lon
ncl 57> print("Regridding with Triple2Grid Now.")
(0) Regridding with Triple2Grid Now.
ncl 58> do ii = 0,dimsizes(rNEW(:,0,0))-1 ;;;;;;Should be 0,239
ncl 59> rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d),
ndtooned(rain_new(ii,:,:)),Lon,Lat,False)
ncl 60> end do
ncl 61> printVarSummary(rNEW)
(0)
(0) min=-999 max=-999
ncl 63> exit
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 11 2009 - 12:25:26 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 11 2009 - 14:54:53 MDT