OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
gen_sdr_fname.c
Go to the documentation of this file.
1 #include "viirs_sim_sdr.h"
2 
3 int gen_sdr_fname(int isdr, char *path, sdr_info_struc *sdr_info,
4  int fname_opt, char *fname)
5 /*-----------------------------------------------------------------------------
6  Program: gen_sdr_fname
7 
8  Description: generate the standard VIIRS file name from the sdr
9  information
10 
11  Arguments:
12  Type Name I/O Description
13  ---- ---- --- -----------
14  int isdr I sdr index: 0 is for geo, 1 - 13 is for
15  the band data
16  char * path I location to place the file
17  sdr_info_struc * sdr_info I general sdr information
18  int fname_opt I file name create option, 0 - std VIIRS,
19  1 - omit create time
20  char * fname I/O final file name
21 
22  Modification history:
23 
24  W. Robinson, SAIC 3 Feb, 2009 Original development
25 
26 ----------------------------------------------------------------------------*/ {
27  int mode = 0;
28  char prefix[350], cre_t_str[13];
29  /*
30  * make a simple name using the old method
31  */
32  if (mode == 1) {
33  if (isdr == 0)
34  sprintf(fname, "V%s_GEO.h5", sdr_info->ofile_base);
35  else
36  sprintf(fname, "V%s_SDRM%d.h5", sdr_info->ofile_base,
37  isdr);
38  } else {
39  /*
40  * create the name based on the standard viirs naming convention
41  */
42  if (isdr == 0) {
43  sprintf(prefix, "%s/GMTCO_npp_", path);
44  } else {
45  sprintf(prefix, "%s/SVM%2.2d_npp_", path, isdr);
46  }
47  /*
48  * use all of create time to microsecs but remove the '.'
49  */
50  if (fname_opt == 0) {
51  strncpy(cre_t_str, sdr_info->cre_time, 6);
52  strncpy(cre_t_str + 6, sdr_info->cre_time + 7, 6);
53  sprintf(fname, "%sd%s_t%6.6s0_e%6.6s0_b00001_c%s%12.12s_%s_%s.h5",
54  prefix, sdr_info->st_date, sdr_info->st_time, sdr_info->en_time,
55  sdr_info->cre_date, cre_t_str, sdr_info->origin,
56  sdr_info->domain);
57  } else {
58  sprintf(fname, "%sd%s_t%6.6s0_e%6.6s0_b00001_%s_%s.h5",
59  prefix, sdr_info->st_date, sdr_info->st_time, sdr_info->en_time,
60  sdr_info->origin, sdr_info->domain);
61  }
62  }
63  printf("%s, %d: created file name: %s\n", __FILE__, __LINE__, fname);
64  return 0;
65 }
int gen_sdr_fname(int isdr, char *path, sdr_info_struc *sdr_info, int fname_opt, char *fname)
Definition: gen_sdr_fname.c:3
README for MOD_PR02AQUA(AQUA) Version to set to For disabling creating and output data sets when in night mode
Definition: README.txt:96
string path
Definition: color_dtdb.py:221
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)