@@ -25,7 +25,7 @@ c (WCS) standard as defined in "WCS Paper II",
2525c Calabretta & Greisen (2002), A&A 395, 1077.
2626c @ in
2727c The input image name. In the first instance, coordinate
28- c descriptors for the output image are copied from the input.
28+ c descriptors for the output image are copied from the input.
2929c They may then be overridden by other parameters as described
3030c below. No default.
3131c @ out
@@ -130,7 +130,7 @@ c AIR Airy (1,D)
130130c Cylindricals:
131131c CYP Cylindrical perspective (2,G|D)
132132c CEA Cylindrical equal area (1,E,G)
133- c CAR Plate carrée (aka Cartesian) (0,G) - please note that
133+ c CAR Plate Carrée (aka Cartesian) (0,G) - please note that
134134c this is NOT the same as the simple linear system used
135135c previously unless the reference coordinates (CRVAL)
136136c are (0,0)
@@ -200,7 +200,7 @@ c@ options
200200c Extra processing options that alter the axis description defined
201201c by the template image, axis descriptors, or input image.
202202c Several can be given, separated by commas, with minimum-match.
203- c altprj Interpret a CAR (plate carée ) projection in the
203+ c altprj Interpret a CAR (Plate Carrée ) projection in the
204204c input ot template image as a simple linear
205205c coordinate system with an additional 1/cos(lat0)
206206c scaling factor applied when computing the longitude,
@@ -232,6 +232,11 @@ c@ tol
232232c Interpolation tolerance. Tolerate an error of the specified
233233c amount in converting pixel locations in the input to the output.
234234c Must be less that 0.5. The default is 0.05.
235+ c @ div
236+ c Number of divisions of the coordinate axes to use with offset
237+ c option. Some projections, like TAN, require finer division near
238+ c discontinuities. Default is 10 on first 3 axes. Suggested
239+ c maximum: 200. Specify up to 3 values.
235240c
236241c --
237242c History:
@@ -255,7 +260,7 @@ c-----------------------------------------------------------------------
255260 * maxc(3 ), maxv(3 ), minc(3 ), minv(3 ), n, naxes,
256261 * nAxIn(MAXNAX), nAxOut(MAXNAX), nAxTem(MAXNAX), nblank,
257262 * nBuf(3 ), ndesc, nIAxes, npv, nTAxes, nxy, off(3 ),
258- * offset, order(3 ), xyzero
263+ * offset, order(3 ), xyzero, div( 3 ), ndiv
259264 ptrdiff xv, yv, zv, valid, rBuf, lBuf
260265 real tol, fblank
261266 double precision cdelt, crpix, crval, desc(4 ,MAXNAX), latpol,
@@ -319,6 +324,15 @@ c Get the input parameters.
319324 if (tol.lt. 0.0 .or. tol.ge. 0.5 )
320325 * call bug(' f' ,' Invalid value for the tol parameter' )
321326
327+ if (doOff) then
328+ call mkeyi(' div' ,div,3 ,ndiv)
329+ do i= ndiv+1 ,3
330+ div(i) = 10
331+ enddo
332+ if (div(1 ).le. 0.or .div(2 ).le. 0.or .div(3 ).le. 0 )
333+ * call bug(' f' ," Invalid div values" )
334+ endif
335+
322336 call keyfin
323337
324338c Open the input dataset.
@@ -515,7 +529,7 @@ c Set up output celestial coordinates.
515529 call setCel(lIn, cOut, doDesc, doEqEq, doGalEq)
516530
517531c Set up offset coordinates.
518- if (doOff) call doOffset(lIn,nAxIn,cOut,nAxOut)
532+ if (doOff) call doOffset(lIn,nAxIn,cOut,nAxOut,div )
519533
520534c Initialise coordinate conversions.
521535 call pCvtInit(cOut,lIn)
@@ -848,29 +862,27 @@ c Put coordinates in the normal orientation, i.e. with north up.
848862
849863c ***********************************************************************
850864
851- subroutine doOffset (lIn ,nAxIn ,lOut ,nAxOut )
865+ subroutine doOffset (lIn ,nAxIn ,lOut ,nAxOut , div )
852866
853- integer lIn,lOut,nAxIn(3 ),nAxOut(3 )
867+ integer lIn,lOut,nAxIn(3 ),nAxOut(3 ),div( 3 )
854868c -----------------------------------------------------------------------
855869 include ' maxdim.h'
856870
857- integer NV
858871 double precision TOL
859- parameter (NV = 10 , TOL = 0.49d0 )
872+ parameter (TOL = 0.49d0 )
860873
861- logical first, valid(NV,NV,NV ), warned, weird(3 )
874+ logical first, valid(div( 1 ),div( 2 ),div( 3 ) ), warned, weird(3 )
862875 integer i, j, k, l, maxv(3 ), minv(3 ), nv1, nv2, nv3
863- double precision crpix, in (3 ), out (3 ,NV,NV,NV )
876+ double precision crpix, in (3 ), out (3 ,div( 1 ),div( 2 ),div( 3 ) )
864877
865878 external itoaf
866879 character itoaf* 2
867880c -----------------------------------------------------------------------
868881 call pCvtInit(lIn,lOut)
869882
870- nv1 = min (max (3 ,nAxIn(1 )),NV)
871- nv2 = min (max (3 ,nAxIn(2 )),NV)
872- nv3 = min (max (3 ,nAxIn(3 )),NV)
873-
883+ nv1 = min (max (3 ,nAxIn(1 )),div(1 ))
884+ nv2 = min (max (3 ,nAxIn(2 )),div(2 ))
885+ nv3 = min (max (3 ,nAxIn(3 )),div(3 ))
874886 first = .true.
875887 do k = 1 , nv3
876888 do j = 1 , nv2
@@ -1161,7 +1173,7 @@ c-----------------------------------------------------------------------
11611173 zv(i,j) = real (out (3 ))
11621174 else
11631175 zv(i,j) = real (in (3 ))
1164- endif
1176+ endif
11651177 endif
11661178 enddo
11671179 enddo
0 commit comments