OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
MOD06AlbedoEcoModule.f90
Go to the documentation of this file.
2 
3 ! HI
4 !****************************************************************************
5  ! !F90
6  !
7  ! !Description:
8  ! This module contains the subroutines used to provide albedo and ecosystem
9  ! maps for processing a MOD06 granule.
10  ! There is only one callable routine, getAlbedoEco, which returns albedo
11  ! values and IGBP ecosystem classification for each pixel of the MOD06 granule,
12  ! and for the wavelengths specified. Also returned are values of snow albedos
13  ! by ecosystem class for the wavelengths specified.
14  !
15  ! !Callable routines:
16  ! getAlbedoEco()
17  !
18  ! !Revision History:
19  !
20  ! Revision 1.0 2003/12/18 12:43:43 EGMoody
21  ! Initial revision.
22  !
23  ! !Team-Unique Header:
24  ! Cloud Retrieval Group, NASA Goddard Space Flight Center
25  !
26  ! !References and Credits:
27  ! Written by
28  ! Eric Moody
29  ! Climate and Radiation Branch, Code 913
30  ! NASA/GSFC
31  ! Greenbelt MD 20771
32  ! Eric.Moody@gsfc.nasa.gov
33  !
34  ! !Design Notes:
35  !
36  ! !END
37  !*****************************************************************************
38 
39  !Dependencies:
40 
42  implicit none
43 
44  ! WDR out
45  ! include "hdf.f90"
46  ! include "dffunc.f90"
47 
48 
49  private
50 
51  ! WDR public :: GetNISEType, ReadSnowAlbStats, init_NISE_processing
52  public :: readsnowalbstats
53 
54 
55 
56  !local variables:
57  !counters:
58  integer :: i,j,k,l,m,n
59 
60  !HDF variables:
61  integer :: HDFstatus
62  integer, dimension(10) :: hdfStart, hdfStride, hdfEdge
63  integer :: sds_id, sds_index
64  ! HDFstatus: Used for error checking.
65  ! hdfstart : Follows HDF conventions. The array element from which to begin reading the
66  ! HDF array. Zero based.
67  ! hdfstride: Follows HDF conventions. The frequency with which data should be read in
68  ! each dimension. Stride 1 means read every element.
69  ! hdfedge : Follows HDF conventions. The number of elements to read in each dimension.
70  ! If start(:) == 0 and stride(:) == 1, setting edge equal to the shape of
71  ! the underlying array reads all elements.
72 
73 
74  INTEGER, PARAMETER :: gridsize = 721
75  integer*2, DIMENSION(gridsize, gridsize) :: niseNorth, niseSouth
76 
77 
78 contains
79 
80 ! subroutine init_NISE_processing(nise_file)
81 !
82 ! character(len=*), intent(in) :: nise_file
83 ! integer :: iret
84 !
85 ! iret = Read_NISE(nise_file, gridsize, niseNorth, niseSouth)
86 !
87 !
88 !
89 ! end subroutine init_NISE_processing
90 
91 
92 
93  ! ----------------------------------------------------------------------------------
94  ! ----------------------------------------------------------------------------------
95 
96 !#ifdef GEOS5_SFC
97 ! SUBROUTINE GetNISEType(lon, lat, snowIceType, errorLevel, lat_start, lat_end)
98 !#else
99 ! SUBROUTINE GetNISEType(lon, lat, snowIceType, errorLevel)
100 !#endif
101 ! !...............................................................................
102 ! !
103 ! !...............................................................................
104 ! ! !F90
105 ! !
106 ! ! !DESCRIPTION:
107 ! ! return snow ice type using "Near Real-Time SSM/I EASE-Grid Daily
108 ! ! Global Ice Concentration and Snow Extent (NISE)" data file from NSIDC.
109 ! ! If NISE is not available, leave the snowIceType array untouched.
110 ! !
111 ! !
112 ! ! !INPUT PARAMETERS:
113 ! !
114 ! ! lat: latitudes (in degrees: -90 to 90)
115 ! ! lon: longitudes (in degrees: -180 to 180)
116 ! !
117 ! ! !OUTPUT PARAMETERS:
118 ! ! snowIceType:
119 ! ! 0 snow-free land
120 ! ! 1-100 sea ice concentration percentage
121 ! ! 101 permanent ice (Greenland, Antarctica)
122 ! ! 102 not used
123 ! ! 103 dry snow
124 ! ! 104 Not Used / 2000-March 2002 data Wet Snow
125 ! ! 105-251 not used
126 ! ! 252 mixed pixels at coastlines
127 ! ! 253 suspect ice value
128 ! ! 254 corners (undefined)
129 ! ! 255 ocean
130 ! !
131 ! ! errorLevel: return error code, 0 (success) or 1 (fail)
132 ! !...............................................................................
133 ! ! !Revision History:
134 ! !
135 ! !...............................................................................
136 ! ! !Team-unique Header:
137 ! ! Cloud Retrieval Group, NASA/GSFC
138 ! !
139 ! ! !PROGRAMMER:
140 ! ! Jason Li (SM&A)
141 ! ! Climate and Radiation Branch
142 ! ! NASA Goddard Space Flight Center
143 ! ! Greenbelt, Maryland 20771, U.S.A.
144 ! !
145 ! !-------------------------------------------------------------------------------
146 ! ! !END
147 !#ifdef GEOS5_SFC
148 ! use core_arrays, only: snow_cover
149 !#endif
150 !
151 !
152 ! implicit none
153 !
154 !
155 ! REAL, DIMENSION(:,:) :: lat, lon
156 ! INTEGER, DIMENSION(:,:) :: snowIceType
157 ! INTEGER, INTENT(OUT) :: errorLevel
158 !#ifdef GEOS5_SFC
159 ! integer, intent(in) :: lat_start, lat_end
160 !#endif
161 !
162 ! INTEGER :: version, xdim, ydim, iret, nise
163 ! REAL :: x, y, pixel_lon, pixel_lat
164 !
165 !
166 !#ifdef GEOS5_SFC
167 !
168 ! snowIceType = nint(snow_cover(:, lat_start:lat_end)*100.)
169 !
170 !#else
171 ! ! Liam Gumley's NISE reader:
172 ! INTEGER, external :: EZLH_Convert
173 !
174 !
175 ! !**********
176 !
177 ! !Set error level
178 ! errorLevel = 0
179 !
180 ! !Determine x, y sizes:
181 ! xdim = SIZE(snowIceType, dim=1)
182 ! ydim = SIZE(snowIceType, dim=2)
183 !
184 !
185 ! ! Get cell coordinates for southern or northern hemisphere.
186 ! DO m = 1, xdim
187 ! DO n = 1, ydim
188 !
189 ! pixel_lon = lon(m,n)
190 ! pixel_lat = lat(m,n)
191 !
192 ! x = min( max( pixel_lon, -179.99 ), 179.99 )
193 ! y = min( max( pixel_lat, -89.99 ), 89.99 )
194 !
195 ! IF ( y < 0.0 ) THEN
196 ! iret = EZLH_Convert( 'Sl', y, x, i, j )
197 ! ELSE
198 ! iret = EZLH_Convert( 'Nl', y, x, i, j )
199 ! ENDIF
200 !
201 ! ! Save output NISE data for southern or northern hemisphere
202 ! ! NISE data grid value definitions:
203 ! !
204 ! ! Data Grid Value Meaning
205 ! ! 0 snow-free land
206 ! ! 1-100 sea ice concentration percentage
207 ! ! 101 permanent ice (Greenland, Antarctica)
208 ! ! 102 not used
209 ! ! 103 dry snow
210 ! ! 104 Not Used / 2000-March 2002 data Wet Snow
211 ! ! 105-251 not used
212 ! ! 252 mixed pixels at coastlines
213 ! ! 253 suspect ice value
214 ! ! 254 corners (undefined)
215 ! ! 255 ocean
216 !
217 ! IF ( iret /= 0 ) THEN
218 ! errorLevel = 1
219 ! ELSE
220 ! IF( y < 0.0 ) THEN
221 ! nise = niseSouth( i, j )
222 ! ELSE
223 ! nise = niseNorth( i, j )
224 ! ENDIF
225 !
226 !
227 ! !Set the snow/ice type and flag:
228 ! SELECT CASE (nise)
229 ! CASE(1:100)
230 ! !sea ice:
231 ! snowIceType(m,n) = nise
232 ! CASE(101)
233 ! !perm ice:
234 ! snowIceType(m,n) = 101
235 ! CASE(103)
236 ! !dry snow:
237 ! snowIceType(m,n) = 103
238 ! CASE(104)
239 ! !wet snow:
240 ! !For the 2000-March 2002 data, the snow is further divided by
241 ! ! wet and dry snow. Per the NISE documentation, the wet class
242 ! ! was inaccurate and thereby no longer used after March 2002.
243 ! ! For reprocesing of 2000-March 2002 data, set this value to
244 ! ! dry snow so that the collection has consistent snow albedo
245 ! ! values. This is the change for collection 5.
246 ! snowIceType(m,n) = 103
247 ! CASE(252)
248 ! !mixed scene pixels at coasts
249 ! snowIceType(m,n) = 252
250 ! CASE(200)
251 ! !Fill scene pixels:
252 ! snowIceType(m,n) = 200
253 ! CASE DEFAULT
254 ! !no snow/ice, so set this type to 0:
255 ! snowIceType(m,n) = 0
256 ! END SELECT
257 !
258 ! ENDIF
259 ! END DO
260 ! END DO
261 !#endif
262 !
263 ! END SUBROUTINE GetNISEType
264 
265  ! ----------------------------------------------------------------------------------
266  ! ----------------------------------------------------------------------------------
267 
268  subroutine readsnowalbstats ( StatsFN, NumSnowTypes, NumAlbBnds, numEco, &
269  AlbedoMean, errorLevel )
270 
271  character (len = *), intent( in) :: statsfn
272  real , &
273  dimension(:,0:,:), intent(inout):: albedomean
274  integer , intent( in) :: numalbbnds, &
275  numeco, &
276  numsnowtypes
277  INTEGER, INTENT(OUT) :: errorlevel
278 
279  ! !Description:
280  ! This routine will output only a single band of albedo, for the specified amount
281  ! of data, to the specified position within the hdf file.
282  !
283  ! !Input Parameters:
284  ! StatsFN : The name, only, of the new HDF file.
285  ! Albedo : Contains the single band of albedo to be stored.
286  ! NumSnowTypes : 2, Dry or wet, via NISE classes.
287  ! NumAlbBnds : Number of Albedo wavelengths.
288  ! numEco : Number of Ecosystem Classes.
289  !
290  ! !Output Parameters:
291  ! AlbedoMean : Mean statistic
292  !
293  ! !Revision History:
294  ! See Module revision history at the beginning of the file.
295  !
296  ! !Team-Unique Header:
297  ! Cloud Retrieval Group, NASA Goddard Space Flight Center
298  !
299  ! !References and Credits:
300  ! Written by
301  ! Eric Moody
302  ! Climate and Radiation Branch, Code 913
303  ! NASA/GSFC
304  ! Greenbelt MD 20771
305  ! Eric.Moody@gsfc.nasa.gov
306  !
307  ! !Design Notes:
308  !
309  ! !END
310 
311  !local variables:
312  !HDF variables:
313  integer :: status
314  integer , dimension(10) :: hdfstart, hdfstride, hdfedge
315  integer :: sds_id, newhdfid, sds_index
316  character(len = 200) :: sdsname
317  real , &
318  dimension(1:2,1:NumAlbBnds,0:numEco,1:1,1:2) :: dummyalb
319  ! status : Used for error checking.
320  ! hdfstart : Follows HDF conventions. The array element from which to begin reading the
321  ! HDF array. Zero based.
322  ! hdfstride : Follows HDF conventions. The frequency with which data should be read in
323  ! each dimension. Stride 1 means read every element.
324  ! hdfedge : Follows HDF conventions. The number of elements to read in each dimension.
325  ! If start(:) == 0 and stride(:) == 1, setting edge equal to the shape of
326  ! the underlying array reads all elements.
327  ! sds_id,
328  ! newHDFID : HDF SDS ID.
329  ! sds_index : Index of the SDS in the HDF file.
330  ! SDSName : Stores the name of the SDS being procesed.
331 
332  ! WDR definitions needed in replacing ftn hdf i/o package
333  integer c_sfstart
334  external c_sfstart
335  integer c_sfselect
336  external c_sfselect
337  integer c_sfn2index
338  external c_sfn2index
339  integer c_sfginfo
340  external c_sfginfo
341  integer c_sfrdata
342  external c_sfrdata
343  integer c_sfendacc
344  external c_sfendacc
345  integer c_sfend
346  external c_sfend
347  integer :: dfacc_read = 1
348  integer :: fail = -1
349 
350  !Set error level
351  errorlevel = success
352 
353  !************************************************************************************
354  ! Open the input file:
355  !************************************************************************************
356  !Open the albedo HDF file:
357  newhdfid = c_sfstart( trim(statsfn), dfacc_read )
358  if (newhdfid == fail) then
359  print *, "Can't Reopen the NEW HDF File", trim(statsfn)
360  errorlevel = fail
361  return
362  end if
363 
364 
365  !************************************************************************************
366  ! Input the Albedo mean statistic:
367  !************************************************************************************
368  !Set up the output hdf variables, in this case we are writing a Belt:
369  ! hdfStart, note that we are storing the entire Longitude, Albedo Bands and Ecosystems
370  ! so these start at 0, however we are storing a box of Latitude, so this starts at the
371  ! starty counter.
372  hdfstart( : ) = 0
373  hdfstart( 5 ) = 0 !Latitude, 0 = NH, 1 = SH
374  hdfstart( 4 ) = 0 !Longitude, only 1, so 0
375  hdfstart( 3 ) = 0 !Eco
376  hdfstart( 2 ) = 0 !AlbBands
377  hdfstart( 1 ) = 0 !NumSnowTypes
378 
379  !Strides = 1, since we are not skiping points
380  hdfstride( : ) = 1
381 
382  !Edge is the total number of points being read:
383  ! It is the number of Albedo bands, the number of Ecosystems, the Number of Longitude
384  ! boxes, and 1 lat box:
385  hdfedge( : ) = 1
386  hdfedge( 5 ) = 2
387  hdfedge( 4 ) = 1
388  hdfedge( 3 ) = numeco
389  hdfedge( 2 ) = numalbbnds
390  hdfedge( 1 ) = numsnowtypes
391 
392  !Read the Mean data:
393  sdsname = 'Snow_Albedo_Year_Mean'
394  !determine the sds_index for the SDS:
395  sds_index = c_sfn2index( newhdfid, trim(sdsname) )
396  !get access to this SDS:
397  sds_id = c_sfselect(newhdfid,sds_index)
398 
399  !Read the data:
400  status = c_sfrdata(sds_id, hdfstart, hdfstride, hdfedge, dummyalb)
401 
402  !Store the dummy data in the final array:
403  do i = 1, numalbbnds
404  do j = 0, numeco-1
405  do k = 1, numsnowtypes
406  albedomean(i,j,k) = dummyalb(k,i,j,1,1)
407  end do
408  end do
409  end do
410 
411  !Error Checking:
412  if (sds_index == fail .or. &
413  sds_id == fail .or. &
414  status == fail) then
415  errorlevel = fail
416  return
417  end if
418 
419  !End Access to the SDS
420  status = c_sfendacc(sds_id)
421  if (status == fail) then
422  errorlevel = fail
423  return
424  end if
425  !************************************************************************************
426  ! Close the file:
427  !************************************************************************************
428  !Close the HDF file:
429  status = c_sfend(newhdfid)
430  if (status == fail) then
431  print *, "Can't End access to the NEW HDF File", trim(statsfn)
432  errorlevel = fail
433  return
434  end if
435 
436 
437  end subroutine readsnowalbstats
438 
439 
440 
441 ! INTEGER FUNCTION READ_NISE( FILENAME, GRIDSIZE, NISE_NORTH, NISE_SOUTH )
442 !
443 !!-----------------------------------------------------------------------
444 !! !F77
445 !!
446 !! !DESCRIPTION:
447 !! To read a "Near Real-Time SSM/I EASE-Grid Daily Global Ice
448 !! Concentration and Snow Extent (NISE)" data file from NSIDC.
449 !! Information on these files is available at
450 !! http://www-nsidc.colorado.edu/NSIDC/CATALOG/catalog_index.html
451 !!
452 !! This function reads the northern and southern hemisphere azimuthal
453 !! equal area grids which are stored at 25 km resolution in HDF-EOS.
454 !!
455 !! To obtain NISE files (which are updated daily), contact NSIDC at
456 !! nsidc@kryos.colorado.edu
457 !!
458 !! !INPUT PARAMETERS:
459 !! FILENAME Name of the NISE file
460 !! GRIDSIZE Dimension for output arrays NISE_N and NISE_S
461 !! (GRIDSIZE=721 for 25 km azimuthal grid)
462 !!
463 !! !OUTPUT PARAMETERS:
464 !! READ_NISE Success flag
465 !! 0 => Success
466 !! -1 => Error opening FILENAME
467 !! -2 => Error reading northern hemisphere grid
468 !! -3 => Error reading southern hemisphere grid
469 !! NISE_NORTH Northern hemisphere data grid
470 !! NISE_SOUTH Southern hemisphere data grid
471 !!
472 !! Data grid value Meaning
473 !! 0 snow-free land
474 !! 1-100 sea ice concentration percentage
475 !! 101 permanent ice (Greenland, Antarctica)
476 !! 102 not used
477 !! 103 dry snow
478 !! 104 wet snow
479 !! 105-251 not used
480 !! 252 mixed pixels at coastlines
481 !! 253 suspect ice value
482 !! 254 corners (undefined)
483 !! 255 ocean
484 !!
485 !! !REVISION HISTORY:
486 !!
487 !! !TEAM-UNIQUE HEADER:
488 !! Developed by the MODIS Group, CIMSS/SSEC, UW-Madison.
489 !!
490 !! !END
491 !!-----------------------------------------------------------------------
492 !
493 ! IMPLICIT NONE
494 !
495 ! ! WDR not required
496 ! !include "hdf.f90"
497 ! !include "dffunc.f90"
498 !
499 !! ... Input arguments
500 !
501 ! CHARACTER filename*(*)
502 ! INTEGER gridsize
503 !
504 !! ... Output arguments
505 !
506 ! integer*2 nise_north( gridsize, gridsize )
507 ! integer*2 nise_south( gridsize, gridsize )
508 !
509 !! ... Local variables
510 !
511 ! INTEGER file_id, grid_id, status
512 !
513 ! INTEGER xsize, ysize
514 !! rhucek 052500: resized upleft and lowrgt to 2 elements
515 !! DOUBLE PRECISION upleft, lowrgt
516 ! DOUBLE PRECISION upleft(2), lowrgt(2)
517 !
518 ! INTEGER start( 2 ), stride( 2 ), edge( 2 )
519 !
520 ! integer*1 temp(gridsize, gridsize)
521 !
522 ! character*80 dummy_name
523 ! integer rank, tp, nattr, i, j
524 !
525 ! ! WDR definitions needed in replacing ftn hdf i/o package
526 ! integer c_sfstart
527 ! external c_sfstart
528 ! integer c_sfselect
529 ! external c_sfselect
530 ! integer c_sfn2index
531 ! external c_sfn2index
532 ! integer c_sfginfo
533 ! external c_sfginfo
534 ! integer c_sfrdata
535 ! external c_sfrdata
536 ! integer c_sfendacc
537 ! external c_sfendacc
538 ! integer c_sfend
539 ! external c_sfend
540 ! integer :: DFACC_READ = 1
541 ! integer :: FAIL = -1
542 !
543 !! ... HDF-EOS functions
544 !
545 !! INTEGER gdopen, gdattach, gddetach, gdclose, gdgridinfo, gdrdfld
546 !! EXTERNAL gdopen, gdattach, gddetach, gdclose, gdgridinfo, gdrdfld
547 !
548 !
549 !!-----------------------------------------------------------------------
550 !! OPEN FILE
551 !!-----------------------------------------------------------------------
552 !
553 !! ... Open file
554 !
555 !! file_id = gdopen( filename, DFACC_READ )
556 ! file_id = c_sfstart(filename, DFACC_READ)
557 ! if ( file_id .eq. -1 ) then
558 ! read_nise = -1
559 ! return
560 ! endif
561 !
562 !!-----------------------------------------------------------------------
563 !! READ NORTHERN HEMISPHERE GRID
564 !!-----------------------------------------------------------------------
565 !
566 !! ... Open northern hemisphere grid
567 !
568 !! grid_id = gdattach( file_id, 'Northern Hemisphere' )
569 ! grid_id = c_sfselect(file_id, 0)
570 !
571 !! ... Get grid information
572 !
573 !! status = gdgridinfo( grid_id, xsize, ysize, upleft, lowrgt )
574 ! status = c_sfginfo(grid_id, dummy_name, rank, edge, tp, nattr)
575 !
576 !! ... Read grid data
577 !
578 ! start( 1 ) = 0
579 ! start( 2 ) = 0
580 ! stride( 1 ) = 1
581 ! stride( 2 ) = 1
582 !! edge( 1 ) = xsize
583 !! edge( 2 ) = ysize
584 !! status = gdrdfld( grid_id, 'Extent', start, stride, edge, nise_north )
585 ! status = c_sfrdata(grid_id, start, stride, edge, temp)
586 ! if ( status .lt. 0 ) then
587 ! read_nise = -2
588 ! return
589 ! endif
590 !
591 ! do i=1, edge(1)
592 ! do j=1, edge(2)
593 ! nise_north(i,j) = temp(i,j)
594 ! if (temp(i,j) == -4) nise_north(i,j) = 252
595 ! if (temp(i,j) == -3) nise_north(i,j) = 253
596 ! if (temp(i,j) == -2) nise_north(i,j) = 254
597 ! if (temp(i,j) == -1) nise_north(i,j) = 255
598 ! end do
599 ! end do
600 !
601 !
602 !
603 !! Call routine to fill in snow/ice info for coastal regions as
604 !! much as possible (northern hemisphere).
605 ! call massage_snowice(nise_north,edge(1),edge(2))
606 !
607 !! ... Close northern hemisphere grid
608 !
609 !! status = gddetach( grid_id )
610 ! status = c_sfendacc(grid_id)
611 !
612 !!-----------------------------------------------------------------------
613 !! READ SOUTHERN HEMISPHERE GRID
614 !!-----------------------------------------------------------------------
615 !
616 !! ... Open southern hemisphere grid
617 !
618 !! grid_id = gdattach( file_id, 'Southern Hemisphere' )
619 ! grid_id = c_sfselect(file_id, 2)
620 !
621 !! ... Get grid information
622 !
623 !! status = gdgridinfo( grid_id, xsize, ysize, upleft, lowrgt )
624 ! status = c_sfginfo(grid_id, dummy_name, rank, edge, tp, nattr)
625 !
626 !! ... Read grid data
627 !
628 ! start( 1 ) = 0
629 ! start( 2 ) = 0
630 ! stride( 1 ) = 1
631 ! stride( 2 ) = 1
632 !! edge( 1 ) = xsize
633 !! edge( 2 ) = ysize
634 !! status = gdrdfld( grid_id, 'Extent', start, stride, edge, nise_south )
635 ! status = c_sfrdata(grid_id, start, stride, edge, temp)
636 ! if ( status .lt. 0 ) then
637 ! read_nise = -3
638 ! return
639 ! endif
640 !
641 ! do i=1, edge(1)
642 ! do j=1, edge(2)
643 ! nise_south(i,j) = temp(i,j)
644 ! if (temp(i,j) == -4) nise_south(i,j) = 252
645 ! if (temp(i,j) == -3) nise_south(i,j) = 253
646 ! if (temp(i,j) == -2) nise_south(i,j) = 254
647 ! if (temp(i,j) == -1) nise_south(i,j) = 255
648 ! end do
649 ! end do
650 !
651 !! Call routine to fill in snow/ice info for coastal regions as
652 !! much as possible (southern hemisphere).
653 ! call massage_snowice(nise_south,edge(1),edge(2))
654 !
655 !! ... Close southern hemisphere grid
656 !
657 !! status = gddetach( grid_id )
658 ! status = c_sfendacc(grid_id)
659 !
660 !!-----------------------------------------------------------------------
661 !! CLOSE FILE
662 !!-----------------------------------------------------------------------
663 !
664 !! ... Close file and return success flag
665 !
666 !! status = gdclose( file_id )
667 ! status = c_sfend(file_id)
668 ! read_nise = 0
669 !
670 !
671 !
672 ! END FUNCTION READ_NISE
673 
674 !---------------------------------------------------------------------
675 !---------------------------------------------------------------------
676 !---------------------------------------------------------------------
677 
678 
679 ! subroutine massage_snowice(map_nise,xsize,ysize)
680 !
681 !!---------------------------------------------------------------------
682 !!!F77
683 !!
684 !!!Description:
685 !! Subroutine for filling in snow and ice information in coastal
686 !! regions. For all coast pixels in the NISE data, search both
687 !! latitudinally and longitudinally for non-coast pixels which
688 !! indicate snow or ice. Stop search when non-snow/ice, non-coast
689 !! pixels are found. For those coast pixels which have snow/ice
690 !! pixels indicated on their boundaries, set flag to indicate
691 !! snow/ice.
692 !!
693 !!!Input Parameters:
694 !! map_nise Input/output snow/ice data grid
695 !! xsize Grid size in the horizontal direction
696 !! ysize Grid size in the vertical direction
697 !!
698 !!!Output Parameters:
699 !! map_nise Input/output snow/ice data grid
700 !!
701 !!!Revision History:
702 !! Original subroutine:
703 !! 03-09-04 R. Frey
704 !!
705 !!!Team-Unique Header:
706 !!
707 !!!References and Credits:
708 !! See Cloud Mask ATBD-MOD-06.
709 !!
710 !!!End
711 !!----------------------------------------------------------------------
712 !
713 ! implicit none
714 ! save
715 !
716 ! !Arguments.
717 ! integer xsize, ysize
718 ! integer*2 map_nise(xsize,ysize)
719 !
720 ! !Local arrays.
721 ! integer k(4)
722 !
723 ! !Local scalars.
724 ! integer temp_nise, i, j, m, n
725 !
726 ! !Loop through map data.
727 !
728 ! do j = 1, xsize
729 !
730 ! do i = 1, ysize
731 !
732 ! temp_nise = 0
733 !
734 ! !Check for coast pixel (value = 252).
735 !
736 !
737 ! if( map_nise(j,i) .eq. 252 ) then
738 !
739 ! !Check if on map edges. Cannot search on all four sides.
740 ! !No data in corners.
741 !
742 ! if(j .eq. 1) then
743 ! k(1) = map_nise(j+1,i)
744 ! k(2) = map_nise(j,i-1)
745 ! k(3) = map_nise(j,i+1)
746 ! k(4) = 0
747 !
748 ! else if(i .eq. 1) then
749 ! k(1) = map_nise(j,i+1)
750 ! k(2) = map_nise(j+1,i)
751 ! k(3) = map_nise(j-1,i)
752 ! k(4) = 0
753 !
754 ! else if(j .eq. xsize) then
755 ! k(1) = map_nise(j-1,i)
756 ! k(2) = map_nise(j,i-1)
757 ! k(3) = map_nise(j,i+1)
758 ! k(4) = 0
759 !
760 ! else if(i .eq. ysize) then
761 ! k(1) = map_nise(j,i-1)
762 ! k(2) = map_nise(j+1,i)
763 ! k(3) = map_nise(j-1,i)
764 ! k(4) = 0
765 !
766 ! else
767 !
768 ! !Get all four adjacent values.
769 ! k(1) = map_nise(j,i-1)
770 ! k(2) = map_nise(j,i+1)
771 ! k(3) = map_nise(j-1,i)
772 ! k(4) = map_nise(j+1,i)
773 !
774 ! end if
775 !
776 ! !Fill in missing snow/ice values (=200).
777 ! do m = 1,4
778 !
779 ! n = k(m)
780 ! if(n .ne. 0) then
781 !
782 ! if((n .eq. 103 .or. n .eq. 104 .or. n .eq. 200) .or. &
783 ! (n .gt. 25 .and. n .lt. 102)) then
784 ! temp_nise = 200
785 ! end if
786 !
787 ! end if
788 ! enddo
789 !
790 !
791 ! if (temp_nise .eq. 200) map_nise(j,i) = temp_nise
792 !
793 ! end if
794 !
795 !
796 ! enddo
797 !
798 ! enddo
799 !
800 ! return
801 ! end subroutine massage_snowice
802 
803 !---------------------------------------------------------------------
804 !---------------------------------------------------------------------
805 !---------------------------------------------------------------------
806 
807 
808 end module mod06albedoecomodule
string & trim(string &s, const string &delimiters)
Definition: EnvsatUtil.cpp:29
subroutine, public readsnowalbstats(StatsFN, NumSnowTypes, NumAlbBnds, numEco, AlbedoMean, errorLevel)