How to set Latitude and Longitude range (Vis5D topography file), make it 0 ~ 360
Curtis Rueden
ctrueden at wisc.edu
Tue May 16 13:07:51 MDT 2006
Hi,
I am not an expert on the netCDF format, but will try to comment as best I
can.
If you do not call setRange at all, does the auto-scaling sets the range as
-180 to 180? If so, it would seem your data's range is actually -180 to 180
(unless perhaps there is a bug in the netCDF reader?). If you want it to
display as 0 to 360 instead, you could replace the domain set with one
ranging from 0 to 360, or use an OffsetUnit to adjust the values. However,
it looks like you have tried to replace the domain set, which should work,
assuming the ranges of the two data objects line up properly.
If you cannot figure it out, I would be willing to investigate your problem
a bit if you can send me your data files and source code demonstrating the
issue.
-Curtis
On 5/14/06, 劉育帆 <monica at cwb.gov.tw> wrote:
>
> Dear All:
>
> I use a "McIDAS Base Map" file and a "Vis5D topography" file
> to match a netcdf file. but it get some error..
>
> My netcdf file range :
> Latitude : -90 ~ 90
> Longitude : 0.0 ~ 357.5
>
> I use
>
> [code]
> Vis5DTopoForm topoAdapter = new Vis5DTopoForm();
> topoImage = topoAdapter.open(new URL(topoFile));
>
> //set Latitude and Longitude range, lonRange[0] = 0.0, lonRange[1]
> 357.5
> double lonRange[] = lonMap.getRange();
> double latRange[] = latMap.getRange();
> lonMap.setRange(lonRange[0], lonRange[1]);
> latMap.setRange(latRange[0], latRange[1]);
>
> ............
>
> //topoAdapter
> FunctionType imageFunctionType = (FunctionType) topoImage.getType();
> RealTupleType imageDomainType = imageFunctionType.getDomain();
> RealTupleType imageRangeType = (RealTupleType)
> imageFunctionType.getFlatRange();
> ScalarMap rgbMap = new ScalarMap((RealType)
> imageRangeType.getComponent(0), Display.RGB);
> display.addMap(rgbMap);
>
> //set Vis5D topography map range
> LinearLatLonSet origin_set
> (LinearLatLonSet)((FlatField)topoImage).getDomainSet();
> int origin_length[]
> origin_set.getLengths();
> LinearLatLonSet domain_set = new LinearLatLonSet(imageDomainType,
> lonRange[0], lonRange[1], origin_length[0], latRange[1], latRange[0],
> origin_length[1]);
> FlatField vals_ff = new FlatField(imageFunctionType, domain_set);
> double[][] flat_samples = ((FlatField)topoImage).getValues();
> vals_ff.setSamples(flat_samples, false);
>
> DataReferenceImpl imageRef = new DataReferenceImpl("ImageRef");
> imageRef.setData(vals_ff);
> [/code]
>
> I try to several ways but not get right result..
>
> 1.Anything not to do
> http://unicle.netfirms.com/visad/ex0502-1.JPG
>
> 2.just set Latitude and Longitude range
> http://unicle.netfirms.com/visad/ex0502.JPG
>
> 3.just set Vis5D topography map range(use LinearLatLonSet)
> http://unicle.netfirms.com/visad/ex0512-1.JPG
>
> 4.both "set Latitude and Longitude range" and "set Vis5D topography map
> range(use LinearLatLonSet)"
> http://unicle.netfirms.com/visad/ex0512.JPG
>
> I think the default range of "Vis5D topography file" is -180 ~ 180.
> so when I want set the new range 0 ~ 360, it could be error..
>
> Could someone give me a direction ? thanks a lot...
>
More information about the visad
mailing list