Is there a "latFlip" command?

From: B N <gkhan100_at_nyahnyahspammersnyahnyah>
Date: Sun, 14 Jun 2009 14:11:43 -0400

Hi. Another newbie question here.
Does NCL have a "latFlip" command? I see lonFlip.
Why? I used NCL to extract PERSIANN precipitation data from binary and
output a netcdf file. When I look at my data in ncview its
upside-down. I attached a picture to show this. I want to turn it
"rightside up."
I think I specified the Lats and Lons correctly. The README file from
the PERSIANN data says:

"The data is a single global grid
400 rows x 1440 col
covering
50N to 50S latitude
& 0 to 360 longitude
at
0.25 x 0.25 deg resolution
Units are
mm/6hr
with NODATA values set negative ( < 0)"

Any small amount of advice would be swell. Thank you!
Sincerely,
Bold
*********************************************************
(Script)
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
setfileoption("bin","ReadByteOrder","BigEndian")
nlat = 400 ;default latitudes in file 0.25 by 0.25 degree
nlon = 1440 ;default longitutdes in file 0.25 by 0.25 degree
fils = systemfunc("ls raw6hr06*.bin")
nfils = dimsizes(fils)
prate = new((/nfils,nlat,nlon/),"float") ; New array for rain
rate
p = new((/nfils,nlat,nlon/),"float") ; New array for rain
do gg = 0,dimsizes(fils)-1 ; Do loop to extract variable
form binary files
prate(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float")
p(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float") * 3 ; rain
per three hours (mm)
end do
prate = where(prate.lt.0.01 , 0.0, prate) ; keep precipitation
values above zero
p = where(p.lt.0.01,0.0,p) ;
;;;;;Assign Coordinate Variable Information;;;;;;;;;;
print("Assigning coordinate variable information")
lat = ispan(0,nlat-1,1)*0.25 - 49.875 ;PERSIANN DATA I think.....?
lat_at_units = "degrees_north"
lon = ispan(0,nlon-1,1)*0.25 - 179.875
lon_at_units = "degrees_east"
prate!0 = "time"
prate&time = ispan(1,dimsizes(fils),1)
prate!1 = "lat"
prate&lat = lat
prate!2 = "lon"
prate&lon = lon
p!0 = "time"
p&time = ispan(1,dimsizes(fils),1)
p!1 = "lat"
p&lat = lat
p!2 = "lon"
p&lon = lon
printVarSummary(prate)
printMinMax(prate,True)
printVarSummary(p)
printMinMax(p,True)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print("Now try for subregion:")
R1 = prate(:,{5:11},{-30:-20})
R2 = prate(:,{7:18},{-20:-10})
R3 = prate(:,{7:18},{-10:10})
R4 = prate(:,{7:18},{10:30})
printVarSummary(R1)
printVarSummary(R2)
printVarSummary(R3)
printVarSummary(R4)

;===========REGRID at 0.50 degree========
NLAT = 200 ; 400/2
MLON = 720; 1440/2
LAT = ispan(0,NLAT-1,1)*0.50 - 49.875; "0.50" degrees
LON= ispan(0,MLON-1,1)*0.50 - 179.875; "0.50" degrees
LAT!0 = "lat"
LAT_at_units = "degrees_north"
LAT&lat = LAT
LON!0 = "lon"
LON_at_units = "degrees_east"
LON&lon = LON
prate_po = area_hi2lores_Wrap (prate&lon,prate&lat, prate, True, 1,
LON, LAT, False)
printVarSummary(prate_po)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Output regridded data
rm= systemfunc("rm PERSIANN_SOP3_0.50x0.50_res_6hr.nc") ;remove the
file we are about to create
b = addfile("PERSIANN_SOP3_0.50x0.50_res_6hr.nc","c")
b_at_title = "1 month of daily accumulated precipitation"
filedimdef(b,"time",-1,True) ; make time an UNLIMITED dimension,
always recommended
b->precipitation_rate=prate_po
b->lat = LAT
b->lon = LON
;==========Free up memory
delete(prate)
delete(prate_po)
;==========
p_po = area_hi2lores_Wrap (p&lon,p&lat, p, True, 1, LON, LAT, False)
printVarSummary(p_po)
b->precipitation=p_po
delete(p)
delete(p_po)
print("Finished!")

*********terminal history

mongol:2006_09_PERS6hr gkhan$ ncl extract_PERSIANN_regrid_plot-SOP3.ncl
 Copyright (C) 1995-2009 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.1.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
(0) Assigning coordinate variable information

Variable: prate
Type: float
Total Size: 276480000 bytes
            69120000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 400] x [lon | 1440]
Coordinates:
            time: [1..120]
            lat: [-49.875..49.875]
            lon: [-179.875..179.875]
Number Of Attributes: 1
  _FillValue : -999
(0)
(0) min=0 max=101.596

Variable: p
Type: float
Total Size: 276480000 bytes
            69120000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 400] x [lon | 1440]
Coordinates:
            time: [1..120]
            lat: [-49.875..49.875]
            lon: [-179.875..179.875]
Number Of Attributes: 1
  _FillValue : -999
(0)
(0) min=0 max=304.789
(0) Now try for subregion:

Variable: R1
Type: float
Total Size: 460800 bytes
            115200 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 24] x [lon | 40]
Coordinates:
            time: [1..120]
            lat: [5.125..10.875]
            lon: [-29.875..-20.125]
Number Of Attributes: 1
  _FillValue : -999

Variable: R2
Type: float
Total Size: 844800 bytes
            211200 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 44] x [lon | 40]
Coordinates:
            time: [1..120]
            lat: [7.125..17.875]
            lon: [-19.875..-10.125]
Number Of Attributes: 1
  _FillValue : -999

Variable: R3
Type: float
Total Size: 1689600 bytes
            422400 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 44] x [lon | 80]
Coordinates:
            time: [1..120]
            lat: [7.125..17.875]
            lon: [-9.875..9.875]
Number Of Attributes: 1
  _FillValue : -999

Variable: R4
Type: float
Total Size: 1689600 bytes
            422400 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 44] x [lon | 80]
Coordinates:
            time: [1..120]
            lat: [7.125..17.875]
            lon: [10.125..29.875]
Number Of Attributes: 1
  _FillValue : -999

Variable: prate_po
Type: float
Total Size: 69120000 bytes
            17280000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 200] x [lon | 720]
Coordinates:
            time: [1..120]
            lat: [-49.875..49.625]
            lon: [-179.875..179.625]
Number Of Attributes: 1
  _FillValue : -999

Variable: p_po
Type: float
Total Size: 69120000 bytes
            17280000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 200] x [lon | 720]
Coordinates:
            time: [1..120]
            lat: [-49.875..49.625]
            lon: [-179.875..179.625]
Number Of Attributes: 1
  _FillValue : -999
(0) Finished!

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Picture_26.png
Received on Sun Jun 14 2009 - 12:11:43 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 15 2009 - 08:53:05 MDT