How to set Latitude and Longitude range (Vis5D topography file), make it 0 ~ 360

劉育帆 monica at cwb.gov.tw
Sun May 14 20:40:24 MDT 2006


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