Re: Problem with rgrid2rcm_Wrap function

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 24 2012 - 09:54:17 MDT

A guess.

The ERA-I data are ordered N->S.

The documentation states

---
lat
A one-dimensional array that specifies the latitude coordinates of the 
regular grid. Must be monotonically increasing.
---
  era_file = addfile("ERAI_sf_19900101_19900131_lessfields.grb","r")
t2m = era_file->2T_GDS4_SFC       ; get T2m (var 167)
printVarSummary(t2m)              ; Note latitude
t2m = t2m(:,::-1,:)               ; Make S->N
printVarSummary(t2m)              ; Note latitude
print(t2m&g4_lat_10)              ; for fun!
xgrd = rgrid2rcm_Wrap(t2m&g4_lat_1, t2m&g4_lon_2, t2m, lat2d, lon2d, 0)
On 10/24/12 9:07 AM, David Jones wrote:
> Dear NCL-talk help,
>
> I am trying to use the rgrid2rcm_Wrap function to regrid reanalysis data
> (ERA Interim) to a WRF domain. Despite trying many different things, I
> cannot get this to work properly. While I am not receiving any error
> messages, the output of xgrd = rgrid2rcm_Wrap() is not as I would expect
> it to be and I cannot do normal procedures with it like plotting (when I
> do a simple contour plot it just gives a uniform value), or when I write
> it to a file and view in ncview it says that all values are missing.
>
> I am using NCL 6.0.0 on a linux cluster. I have included several
> 'printVarSummary(...)' statements in my basic script and everything
> looks fine to me except for the final one, printVarSummary(*xgrd*),
> which gives:
>
> “/Dimensions and sizes: [initial_time0_hours | 124] x [west_east | 279]
> x [XLONG | 569]”/
>
> lon2d and lat2d (taken from WRF XLON and XLAT) originally both had
> (correctly):
>
> “/Dimensions and sizes: [south_north | 279] x [west_east | 569]”/
>
> It doesn't seem right that /west_east/ should be 279 in /xgrd/ after
> using rgrid2rcm_Wrap. It seems like the dimensions of the two different
> input files are somehow getting jumbled up. It also doesn't seem right
> to me that the dimensions of xgrd are /west_east &/ /XLONG/ – I would
> have thought they would be either /south_north/ & /west_east/ *or* /XLAT
> &/ /XLONG/.
>
> Any guidance on what I might be doing wrongly would be most appreciated?
>
> The input reanalysis data is on a Gaussian lat/lon grid (N128
> (~0.7degree)) and the WRF data is on a Lambert Conformal grid. I include
> my basic script and the output I get from the printVarSummary(...)
> statements below. (Also, the problem is no different if I just use the
> rgrid2rcm function).
>
> Many thanks for any help,
> Dave.
>
> *---------------------------SCRIPT----------------------------------*
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> wrf_file = addfile("wrfout_d01_1990-01-01_00:00:00.nc","r")
>
> lat2d = wrf_file->XLAT(0,:,:)
> lon2d = wrf_file->XLONG(0,:,:)
>
> printVarSummary(lat2d)
> printVarSummary(lon2d)
>
> era_file = addfile("ERAI_sf_19900101_19900131_lessfields.grb","r")
>
> t2m = era_file->2T_GDS4_SFC(:,:,:) ; get T2m (var 167)
> printVarSummary(t2m)
>
> g4_lat_1 = era_file->g4_lat_1(:)  ; g4_lat_1 is float name for latitude
> in era file
> printVarSummary(g4_lat_1)
>
> g4_lon_2 = era_file->g4_lon_2(:)  ; g4_lon_2 is float name for longitude
> in era file
> printVarSummary(g4_lon_2)
>
> xgrd = rgrid2rcm_Wrap(t2m&g4_lat_1, t2m&g4_lon_2, t2m, lat2d, lon2d, 0)
>
> printVarSummary(xgrd)
>
> end
>
> *----------------------Output From printVarSummary(...)
> statements-------------*
>
> *Variable: lat2d*
> Type: float
> Total Size: 635004 bytes
> 158751 values
> Number of Dimensions: 2
> Dimensions and sizes: [south_north | 279] x [west_east | 569]
> Coordinates:
> Number Of Attributes: 5
> FieldType : 104
> MemoryOrder : XY
> description : LATITUDE, SOUTH IS NEGATIVE
> units : degree_north
> stagger :
>
> *Variable: lon2d*
> Type: float
> Total Size: 635004 bytes
> 158751 values
> Number of Dimensions: 2
> Dimensions and sizes: [south_north | 279] x [west_east | 569]
> Coordinates:
> Number Of Attributes: 5
> FieldType : 104
> MemoryOrder : XY
> description : LONGITUDE, WEST IS NEGATIVE
> units : degree_east
> stagger :
>
> *Variable: t2m*
> Type: float
> Total Size: 28718400 bytes
> 7179600 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 124] x [g4_lat_1 | 150] x
> [g4_lon_2 | 386]
> Coordinates:
> initial_time0_hours: [1665504..1666242]
> g4_lat_1: [89.46282..-15.08769]
> g4_lon_2: [-150.469..120.234]
> Number Of Attributes: 10
> center : European Center for Medium-Range Weather Forecasts (RSMC)
> long_name : 2 metre temperature
> units : K
> _FillValue : 1e+20
> level_indicator : 1
> gds_grid_type : 4
> parameter_table_version : 128
> parameter_number : 167
> forecast_time : 0
> forecast_time_units : hours
>
> *Variable: g4_lat_1*
> Type: float
> Total Size: 600 bytes
> 150 values
> Number of Dimensions: 1
> Dimensions and sizes: [g4_lat_1 | 150]
> Coordinates:
> g4_lat_1: [89.46282..-15.08769]
> Number Of Attributes: 9
> long_name : latitude
> GridType : Gaussian Latitude/Longitude Grid
> units : degrees_north
> N : 128
> Di : 0.7031247
> Lo2 : 120.234
> La2 : -15.088
> Lo1 : -150.469
> La1 : 89.463
>
> *Variable: g4_lon_2*
> Type: float
> Total Size: 1544 bytes
> 386 values
> Number of Dimensions: 1
> Dimensions and sizes: [g4_lon_2 | 386]
> Coordinates:
> g4_lon_2: [-150.469..120.234]
> Number Of Attributes: 9
> long_name : longitude
> GridType : Gaussian Latitude/Longitude Grid
> units : degrees_east
> N : 128
> Di : 0.7031247
> Lo2 : 120.234
> La2 : -15.088
> Lo1 : -150.469
> La1 : 89.463
>
> *Variable: xgrd*
> Type: float
> Total Size: 78740496 bytes
> 19685124 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 124] x [west_east | 279] x
> [XLONG | 569]
> Coordinates:
> initial_time0_hours: [1665504..1666242]
> Number Of Attributes: 11
> center : European Center for Medium-Range Weather Forecasts (RSMC)
> long_name : 2 metre temperature
> units : K
> _FillValue : 1e+20
> level_indicator : 1
> gds_grid_type : 4
> parameter_table_version : 128
> parameter_number : 167
> forecast_time : 0
> forecast_time_units : hours
> ncl : rgrid2rcm used for interpolation
>
>
>
> _______________________________________________
> 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 Wed Oct 24 09:54:29 2012

This archive was generated by hypermail 2.1.8 : Wed Oct 31 2012 - 09:14:12 MDT