[ncl-talk] variable value for specific location

amit timilsina timilsinaamit87 at huskers.unl.edu
Sun Jun 14 09:25:46 MDT 2015


Hello all, 
Here I am looking for getting variable (tasmin_diff) values for eight different locations. I was expecting 12 different month tasmin_diff values for each of these eight location. But with the syntax used, it resulted other latitude and longitude combination values as well. Since I have many locations, it would be difficult to look each index combination one by one. Is there any way to get only the value for specified location only or not in combination of provided latitude and longitude using NCL?

ncl 0> a=addfile("original_file.nc","r")
ncl 1> lat=a&lat
ncl 2> lon=a&lon
ncl 3> b=a->tasmin_diff
ncl 4> rlat=(/27.9, 29.7, 33.9, 37.8, 39.0,43.2,44.3,45.6/)
ncl 5> rlon=(/ 237.7, 238.9, 241.6, 243.7, 247.3, 249.0,253.7, 254.7/)
ncl 6> i_rlat = ind_nearest_coord (rlat, lat, 0) 
ncl 7> i_rlon= ind_nearest_coord (rlon, lon, 0) 
ncl 8> m=i_rlat
ncl 9> n=i_rlon
ncl 10> c=a->tasmin_diff(:,m,n)
ncl 11> print(c)


Variable: c
Type: float
Total Size: 3072 bytes
            768 values
Number of Dimensions: 3
Dimensions and sizes:   [month | 12] x [lat | 8] x [lon | 8]
Coordinates: 
            month: [0..11]
            lat: [27.04623985290527..45.69869232177734]
            lon: [238.125.. 255]
Number Of Attributes: 13
  missing_value :       1e+20
  info :        function clmMonLLT: contributed.ncl
  time_op_ncl : Climatology: 30 years
  associated_files :    baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_atmos_fx_MPI-ESM-LR_decadal1980_r0i0p0.nc areacella: areacella_fx_MPI-ESM-LR_decadal1980_r0i0p0.nc
  coordinates : height
  history :     2011-11-09T08:48:40Z altered by CMOR: Treated scalar dimension: 'height'.
  cell_measures :       area: areacella
  cell_methods :        time: minimum within days time: mean over days
  units :       K
  comment :     monthly mean of the daily-minimum near-surface air temperature.
  long_name :   Daily Minimum Near-Surface 



Regards,
Amit Timilsina
University of Nebraska Lincoln
-------------- next part --------------
A non-text attachment was scrubbed...
Name: original_file.nc
Type: application/x-netcdf
Size: 47720 bytes
Desc: original_file.nc
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150614/54c88e1e/attachment.nc 


More information about the ncl-talk mailing list