Re: 3D coordinate system

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 28 Jul 2006 11:36:33 -0600

Hi Kyle,

First, I would consider using a different wtmp@_FillValue than 0.
Putting 0 in there may be confusing as 0 could be considered a vaild
temperature... Also, you migth already be doing this, but I would set
the missing_value as well as the _FillValue...

instead of
   wtmp
(0,0) 6
(0,1) 6
(0,2) 6
(0,3) 6
(0,4) 5.9
(0,5) 0 ; change to -999. (=wtmp@_FillValue/missing_value)

In the setup of the watertemp array, you assign x and y as lat and lon,
but the x-array at least is not monotonically increasing/decreasing...
It might be better to set up a new lat and lon array that is based off
of the min(x) max (x) and the min(y) max(y):

lat = ispan(min(x),max(x),50) ; 50 seems to be the smallest
lon = ispan(min(y),max(y),50) ; increment in x/y
watertemp=new((/dimsizes(newlat),dimsizes(newlon),variables/),"float")
watertemp!0 = "lat"
watertemp!1 = "lon"
watertemp!2 = "depth"
watertemp&depth = z
watertemp&lat = lat
watertemp&lon = lon
do u=0, nrow2-1
    watertemp({x(u)},{y(u)},:) = wdata(u,:)
end do

This will give you a number of empty lat/lon pairs over land, but it
does arrange everything on a easy to use grid..
Good luck,
Adam

Kyle Wilcox wrote:
> Hello again all! My problem of the week is:
>
> I have been tasked with converting old legacy data into an OpenDAP
> compatible file type (netCDF). The old files are flat ascii files
> consisting of lat/lon in UTM, depth, and water temp. The first two
> numbers are lat and lon in UTM. The second number is how many readings
> from that coordinate were taken. Following the third number are the
> readings at 1 meter intervals.
>
> 354450,4304200,5,6.0,6.0,6.0,6.0,5.9
> 354400,4304150,4,6.0,6.0,6.0,6.0
> 354450,4304150,2,6.0,6.0
> 354350,4304100,5,6.0,6.0,6.0,6.0,5.9
>
> So I now have x,y, and z as 1D arrays. I also store the water temp in a
> 2D array as (IndexOfLatandLonInXandY, depth).
>
> Ex:
> wtmp
> (0,0) 6
> (0,1) 6
> (0,2) 6
> (0,3) 6
> (0,4) 5.9
> (0,5) 0
> ...
>
> x
> (0) 354450
> (1) 354400
> (2) 354450
> (3) 354350
> (4) 354400
> (5) 354250
> ...
>
> y
> (0) 4304200
> (1) 4304150
> (2) 4304150
> (3) 4304100
> (4) 4304100
> (5) 4304050
> ...
>
> z
> (0) 0
> (1) 1
> (2) 2
> (3) 3
> (4) 4
> (5) 5
> ...
>
>
> My question is, how do I create a 3D array as (lat,lon,depth) =
> the_water_temp? I have tried the following: (variables = max number of
> depths, nrow2 = number of lat and lon pairs)
>
> watertemp=new((/nrow2,nrow2,variables/),"float")
> watertemp!0 = "lat"
> watertemp!1 = "lon"
> watertemp!2 = "depth"
> watertemp&lat = x
> watertemp&lon = y
> watertemp&depth = z
>
> do u=0, nrow2
> do j=0, variables
> watertemp(x(u),y(u),j) = wdata(u,j)
> end do
> end do
>
> But that will generate a lot more pairs of lat and lon than I need, and
> I get the 'Subscripts must be integer when not using coordinate
> indexing' error, which I thought I was using.
>
> Been working on this on and off for awhile, any help would be great!
> Thanks.
>
>

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jul 28 2006 - 11:36:33 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 28 2006 - 16:18:18 MDT