[ncl-talk] Sub: Region selection

dale zuri dalezuri at gmail.com
Wed Nov 22 03:54:56 MST 2017


Hi
I get the error now this lat/lon. After flipping the lon coordinated still
unable to match the region selection between two files.
I would appreciate any help.
Thanks

  diri = "./"
   fili1 = "MERRA2_300.tavg1_2d_int_Nx.20040926.nc4"
   fili = "tmp2m.2012050218.time.nc"
   in  = addfile(diri+fili,"r")
   in1  = addfile(diri+fili1,"r")
print(in1)
;;;;Region1;;;;
lat_min =-60
lat_max =-35
 lon_min = 180
 lon_max =  255
   tmp1  = in1->SWNETTOA
   neb=lonFlip(tmp1)
printVarSummary(tmp1)
printVarSummary(neb)
   tmpp  = neb(:,lat_min:lat_max,lon_min:lon_max)
;   tmpp  = neb(:,:,:)
;   tmp  = in->TMP_P0_L103_GGA0(:,lat_min:lat_max,lon_min:lon_max)
;printVarSummary(tmp1)
printVarSummary(tmpp)
;   ts   = tmp(time|0:0,lat|:,lon|:)               ; reorder variable
;printVarSummary(ts)
 ts = dim_avg_n_Wrap(tmpp, 0 )


;;;;;
Variable: neb
Type: float
Total Size: 19961856 bytes
            4990464 values
Number of Dimensions: 3
Dimensions and sizes:    [time | 24] x [lat | 361] x [lon | 576]
Coordinates:
            time: [0..1380]
            lat: [ -90..  90]
            lon: [-5.920304394294029e-13..359.375]
Number Of Attributes: 12
  long_name :    toa_net_downward_shortwave_flux
  units :    W m-2
  _FillValue :    1e+15
  missing_value :    1e+15
  fmissing_value :    1e+15
  scale_factor :     1
  add_offset :     0
  standard_name :    toa_net_downward_shortwave_flux
  vmax :    1e+15
  vmin :    -1e+15
  valid_range :    ( -1e+15, 1e+15 )
  lonFlip :    longitude coordinate variable has been reordered via lonFlip
fatal:Subscript out of range, error in subscript #1
fatal:An error occurred reading neb
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 33 in file
TESTSinglevartime.ncl


On Tue, Nov 21, 2017 at 1:17 AM, dale zuri <dalezuri at gmail.com> wrote:

> Hi,
> Please help me to select the same region from the two different files.
> I want to have the region1 selection for both the files. I am not able to
> set the same region1 for Merra data.
> Thanks
>
> begin
> ;************************************************
> ; create pointer to file and read in temperature
> ;************************************************
>    diri = "./"
>    fili1 = "MERRA2_300.tavg1_2d_int_Nx.20040926.nc4"
>    fili = "tmp2m.2012050218.time.nc"
>    in  = addfile(diri+fili,"r")
>    in1  = addfile(diri+fili1,"r")
> print(in1)
> lat_min =-180;;wrong region selection
>   lat_max =180
>   lon_min = 0
>   lon_max = 138
> ;;;;Region1;;;;;;;;;;;;
> lat_min =15
> lat_max =40
>  lon_min = 180
>  lon_max =  255
>    tmp1  = in1->SWNETTOA(:,lat_min:lat_max,lon_min:lon_max)
>    tmp  = in->TMP_P0_L103_GGA0(:,lat_min:lat_max,lon_min:lon_max)
> printVarSummary(tmp1)
> ;   ts   = tmp(time|0:0,lat|:,lon|:)               ; reorder variable
> ;printVarSummary(ts)
>  ts = dim_avg_n_Wrap(tmp, 0 )
>  ts1 = dim_avg_n_Wrap(tmp1, 0 )
>
> Variable: tmp1
> Type: float
> Total Size: 19961856 bytes
>             4990464 values
> Number of Dimensions: 3
> Dimensions and sizes:    [time | 24] x [lat | 361] x [lon | 576]
> Coordinates:
>             time: [0..1380]
>             lat: [ -90..  90]
>             lon: [-180..179.375]
> Number Of Attributes: 11
>   long_name :    toa_net_downward_shortwave_flux
>   units :    W m-2
>   _FillValue :    1e+15
>   missing_value :    1e+15
>   fmissing_value :    1e+15
>   scale_factor :     1
>   add_offset :     0
>   standard_name :    toa_net_downward_shortwave_flux
>   vmax :    1e+15
>   vmin :    -1e+15
>   valid_range :    ( -1e+15, 1e+15 )
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171122/28219229/attachment.html>


More information about the ncl-talk mailing list