# Re: reverse netCDF {dimension, coordinate variable}?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat Jan 12 2013 - 10:17:13 MST

z(ilev,lat,lon) ; ilev: [1.650789985433221..1000]

The following reverses the vertical dimension at every grid point:

; separate variable
zi = z(::-1,:,:) ; ilev: [1000..1.650789985433221]

z = z(::-1,:,:) ; reverse and overwrite

On 1/12/13 9:51 AM, Tom Roche wrote:
>
> Is there NCL API to reverse a dimension? I know I can do this with
> NCO:ncpdq. What I mean:
>
> I want to reverse the order of the members of the dimension=ilev in the
> following:
>
> printVarSummary(z_int_var)
> ; Variable: z_int_var
> ...
> ; Dimensions and sizes: [ilev | 57] x [lat | 21] x [lon | 30]
> ; Coordinates:
> ; ilev: [1.650789985433221..1000]
> ; lat: [59.68421052631579..21.78947368421052]
> ; lon: [-130..-57.5]
> ...
> z_int_var_dims = dimsizes(z_int_var)
> ilev_min = 0
> ilev_max = z_int_var_dims(0)-1
> lat_min = 0
> lat_max = z_int_var_dims(1)-1
> lon_min = 0
> lon_max = z_int_var_dims(2)-1
> ; do [top,bot] for [SW,NW,NE,SE]
> print(z_int_var(ilev_min,lat_min,lon_min))
> ; (0) 43899.82
> print(z_int_var(ilev_max,lat_min,lon_min))
> ; (0) 1157.416
>
> But, for each (lat,lon), z_int_var(ilev,lat,lon) should increase
> directly with ilev, not inversely.
>
> TIA, Tom Roche <Tom_Roche@pobox.com> <Roche.Tom@epa.gov>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Jan 12 10:17:25 2013

This archive was generated by hypermail 2.1.8 : Mon Jan 14 2013 - 14:31:38 MST