[ncl-talk] subset data using region_ind

Stefane Fonseca Freitas fane.freitas at hotmail.com
Tue Mar 26 17:10:31 MDT 2019


Hi users,

I'm trying to subset a satellite swath data (2D latitude and longitude) in a region box. However, when I output the subsetted lat/lon range, it does not match the range I set in the script.

Any suggestions would be greatly appreciated.


*********************************************************************************************************************

Script:

begin



    varname="pr_2a23_hfreez2A23"



    f=addfile("/media/stefane/Seagate Expansion Drive/TRMM-PF/199801/1Z09.19980102.00560.7.HDF", "r")



    var=short2flt_hdf(f->$varname$)                                   ; produto 2A23 altura do nível de congelamento em metros

    var at _FillValue =-9999.



    lat_dbz=short2flt_hdf(f->pr_lat)/100.

    lon_dbz=short2flt_hdf(f->pr_lon)/100.



;---------------------------------------------------------------------------------------------------------
;Subscript para selecionar dados apenas dentro de área de interesse
;
;*****Caixa na Amazõnia coordenadas*************

 latS   = -11.
 latN   =  2.

 lonW   = -72.
 lonE   = -45.

 ji= region_ind(lat_dbz, lon_dbz, latS, latN, lonW, lonE)



  jStrt = ji(0)      ; lat start
  jLast = ji(1)      ; lat last
  iStrt = ji(2)      ; lon start
  iLast = ji(3)      ; lon last

 lat = lat_dbz(jStrt:jLast,iStrt:iLast)
 lon = lon_dbz(jStrt:jLast,iStrt:iLast)




 printMinMax(lat, True)

 printMinMax(lon, True)

sub=var(jStrt:jLast,iStrt:iLast)


sub at lat2d=lat
sub at lon2d=lon


  lat at units="degrees_north"
  lon at units="degrees_east"


end

*********************************************************************************************************************
print

latitude:

(0) min=-3.43   max=3.55


longitude:

(0) min=-73.12   max=-64.89
************************************************************************************************************************************************************

Stefane Fonseca Freitas

Doutoranda em Meteorologia - PGMET - CPTEC / INPE
Centro de Previsão de Tempo e Estudos Climáticos / Instituto Nacional de Pesquisas Espaciais
Cachoeira Paulista - SP - Brasil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190326/67040490/attachment.html>


More information about the ncl-talk mailing list