Hi
While we can't provide specific code for each situation, we are happy to help you understand the data better so your code will be correct.
For HGG files (the following blue text is output from netcdf utility 'ncdump' to provide insight into the ISCCP parameters):
The cloud types/codes are provided in the variable:
char cloud_type_label(cloud_type, label_len) ;
cloud_type_label:long_name = "Cloud type labels" ;
cloud_type_label:description = "Cloud types determined by cloud top pressure adjusted for optically thinner clouds and optical thickness for liquid and ice clouds determined by cloud top temperature" ;
int time(time) ;
time:long_name = "Time" ;
time:units = "hours since 1970-01-01 00:00:00" ;
time:bounds = "time_bounds" ;
time:calendar = "gregorian" ;
cloud_type_label =
"cumulus_liquid (680 < PC <= 1025hPa, 0 <= TAU <= 3.55, TC >= 253K) ",
"stratocumulus_liquid (680 < PC <= 1025hPa, 3.55 < TAU <= 22.63, TC >= 253K) ",
"stratus_liquid (680 < PC <= 1025hPa, 22.63 < TAU <= 450, TC >= 253K) ",
"cumulus_ice (680 < PC <= 1025hPa, 0 <= TAU <= 3.55, TC < 253K) ",
"stratocumulus_ice (680 < PC <= 1025hPa, 3.55 < TAU <= 22.63, TC < 253K) ",
"stratus_ice (680 < PC <= 1025hPa, 22.63 < TAU <= 450, TC < 253K) ",
"altocumulus_liquid (440 < PC <= 680hPa, 0 <= TAU <= 3.55, TC >= 253K) ",
"altostratus_liquid (440 < PC <= 680hPa, 3.55 < TAU <= 22.63, TC >= 253K) ",
"nimbostratus_liquid (440 < PC <= 680hPa, 22.63 < TAU <= 450, TC >= 253K) ",
"altocumulus_ice (440 < PC <= 680hPa, 0 <= TAU <= 3.55, TC < 253K) ",
"altostratus_ice (440 < PC <= 680hPa, 3.55 < TAU <= 22.63, TC < 253K) ",
"nimbostratus_ice (440 < PC <= 680hPa, 22.63 < TAU <= 450, TC < 253K) ",
"cirrus_liquid (10 <= PC <= 440hPa, 0 <= TAU <= 3.55, TC >= 253K) ",
"cirrostratus_liquid (10 <= PC <= 440hPa, 3.55 < TAU <= 22.63, TC >= 253K) ",
"deep_convective_liquid (10 <= PC <= 440hPa, 22.63 < TAU <= 450, TC >= 253K) ",
"cirrus_ice (10 <= PC <= 440hPa, 0 <= TAU <= 3.55, TC < 253K) ",
"cirrostratus_ice (10 <= PC <= 440hPa, 3.55 < TAU <= 22.63, TC < 253K) ",
"deep_convective_ice (10 <= PC <= 440hPa, 22.63 < TAU <= 450, TC < 253K) " ;
This variable has the dimension 'cloud_type' ... so any variable with that dimension can provide statistics by cloud type. For instance, the following variables have this dimension:
short cldamt_types(time, cloud_type, lat, lon) ;
short pc_type(time, cloud_type, lat, lon) ;
short tc_type(time, cloud_type, lat, lon) ;
short tau_type(time, cloud_type, lat, lon) ;
short wp_type(time, cloud_type, lat, lon) ;
So if you want cloud fraction of liquid cumulus, you would use the cldamt_types variable and select the index associated with liquid cumulus (which is the first based on the listing above).
I hope this helps.
Thanks for asking and happy new year!
-Ken