LONGRHO<-function(bingout) { #takes confidence region produced by BINGHAM or BINGROT and projects it onto (long,rho) and (lat,rho) planes #Bingham "type 1" regions (region is a nice football shaped region in lat long rho space) only #all regions produced by LONGRHO, BINGROT, and BINGHAM are simultaneous #bingout is a list with components bound, uppmat, lowmat if (bingout$icase != 1) stop(message="bingham type 1 case only") bound<-bingout$bound uppmat<-bingout$uppmat lowmat<-bingout$lowmat nlong<-nrow(uppmat) nlat<-ncol(lowmat) long0<-floor(min(bound[,1])) long1<-ceiling(max(bound[,1])) lat0<-floor(min(bound[,2])) lat1<-ceiling(max(bound[,2])) dlong<-(long1-long0)/(nlong-1) dlat<-(lat1-lat0)/(nlat-1) xlong<-long0+(0:(nlong-1))*dlong xlat<-lat0+(0:(nlat-1))*dlat rho.u<-ifelse(is.finite(uppmat),uppmat,-200) rho.l<-ifelse(is.finite(lowmat),lowmat,200) up<-apply(rho.u,1,max) lo<-apply(rho.l,1,min) indu<- (up > -200) indl<- (lo < 200) bound.long.rho<-cbind(xlong[indu],up[indu]) bound.long.rho<-rbind(bound.long.rho,cbind(rev(xlong[indl]),rev(lo[indl])),bound.long.rho[1,]) up<-apply(rho.u,2,max) lo<-apply(rho.l,2,min) indu<- (up > -200) indl<- (lo < 200) bound.lat.rho<-cbind(xlat[indu],up[indu]) bound.lat.rho<-rbind(bound.lat.rho,cbind(rev(xlat[indl]),rev(lo[indl])),bound.lat.rho[1,]) c(bingout,list(bound.lat.rho=bound.lat.rho,bound.long.rho=bound.long.rho)) }