Using lat/lons from a low-resolution dataset to subsample a high-resolution dataset

From: Bronwen Konecky <bkonecky_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 17 2014 - 15:37:34 MDT

Hello NCL folks,

I am comparing two satellite datasets with different resolutions. Data1 is
a 5x5 global grid. Data2 is .25x.25 degree between 50S and 50N. I am trying
to use the lat/lons of Data1 (the lower resolution dataset) to select the
nearest gridpoint in Data2 (the hi-res dataset).* I keep getting the
following error:

fatal:NclOneDValGetClosestIndex: finish coordinate index out of range,
can't continue

I tried to reduce the latitudinal extent of Data1 to be similar to or even
smaller than that of Data2, but I continue to get the error.

What am I doing wrong? Code snippet and variable info below.

--
Variable: Data1
Type: float
Total Size: 653184 bytes
            163296 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 63] x [lat | 36] x [lon | 72]
Coordinates:
            time: [4291..6268]
            lat: [-87.5..87.5]
            lon: [-180..175]
Number Of Attributes: 2
  average_op_ncl :      dim_avg_n over dimension(s): lev
  _FillValue :  -999
Variable: Data2
Type: float
Total Size: 145152000 bytes
            36288000 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 63] x [lat | 400] x [lon | 1440]
Coordinates:
            time: [2004.666666666667..2009.916666666667]
            lat: [-49.875..49.875]
            lon: [-179.875..179.875]
Number Of Attributes: 5
  _FillValue :  -9999.9
  missing_value :       -9999.9
  time_statistic :      instantaneous
  units :       mm/hr
  long_name :   precipitation
Code snippet:
; ---- Use Data1 (5x5degree) lat/lons to select nearest gridpoints in Data2
(.25x.25degree) ----
latsub1 = -55.   ; <-- Still get the error if I choose a smaller number
like -49
latsub2 = 55.    ; <-- Still get the error if I choose a smaller number
like 49
Data1latsub = Data1(:,{latsub1:latsub2},:)
data1lat = Data1latsub&lat
data1lon = Data1latsub&lon
printVarSummary(data1lat)
printVarSummary(data1lon)
printMinMax(data1lat,True)
printMinMax(data1lon,True)
printVarSummary(Data2&lat)
printVarSummary(Data2&lon)
printMinMax(Data2&lat,True)
printMinMax(Data2&lon,True)
Data2sub = Data2(:,{data1lat},{data1lon})
printVarSummary(Data2sub)
exit
Output:
Variable: data1lat
Type: float
Total Size: 88 bytes
            22 values
Number of Dimensions: 1
Dimensions and sizes:   [lat | 22]
Coordinates:
Number Of Attributes: 2
  long_name :   Latitude
  units :       degrees_north
Variable: data1lon
Type: float
Total Size: 288 bytes
            72 values
Number of Dimensions: 1
Dimensions and sizes:   [lon | 72]
Coordinates:
Number Of Attributes: 2
  units :       degrees_east
  long_name :   Longitude
(0)
(0)     Latitude: min=-52.5   max=52.5
(0)
(0)     Longitude: min=-180   max=175
Variable: lat (coordinate)
Type: double
Total Size: 3200 bytes
            400 values
Number of Dimensions: 1
Dimensions and sizes:   [lat | 400]
Coordinates:
Number Of Attributes: 2
  long_name :   Latitude
  units :       degrees_north
Variable: lon (coordinate)
Type: double
Total Size: 11520 bytes
            1440 values
Number of Dimensions: 1
Dimensions and sizes:   [lon | 1440]
Coordinates:
Number Of Attributes: 2
  long_name :   Longitude
  units :       degrees_east
(0)
(0)     Latitude: min=-49.875   max=49.875
(0)
(0)     Longitude: min=-179.875   max=179.875
fatal:NclOneDValGetClosestIndex: finish coordinate index out of range,
can't continue
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 160 in
file data_corr.ncl
--
Many thanks,
Bronwen
*P.S. A better approach would be to interpolate the hi-res Data2 dataset to
match the lat/lons of the low-res Data1 dataset. I looked through the
various regridding examples and none seemed appropriate. If anyone has
suggestions on the best way to do this, I'd appreciate it!
-- 
Bronwen Konecky, Ph.D.
Postdoctoral Fellow
School of Earth & Atmospheric Sciences
Georgia Institute of Technology
311 Ferst Dr., Atlanta, GA, 30332-0340
(303) 492-5176
http://blkonecky.wordpress.com/

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 17 15:38:08 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 21 2014 - 15:49:21 MDT