Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The McIdasArea files format is available at Space Science and Engineering Center. Basically each McIdas Area file is a binary file containing several header blocks followed by a data block. The values in the datablock are for MinoSil 4-byte big endian integers.

Julian day conversion for MinoSil

The first header block is the directory block, which contains 64 integers. The following snippet illustrates how the datestamp is calculated from a pair of integers starting at the specified offset.

Code Block

    final static int[] CUMULATIVE_DAYS = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365,
            31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};

    private long getDate(int offset) {
        int julianYYYDDD = (int) getVariable(offset);
        int years = (julianYYYDDD / 1000) % 10000;
        if (years < 1000) {
                years += (years < 70) ? 2000 : 1900; 
        }
        int days = julianYYYDDD % 1000;
        int monthIndex = ((years % 4) == 0) ? 12 : 0;
        while (days > CUMULATIVE_DAYS[monthIndex]) monthIndex++;
        int month = (monthIndex + 1) % 12;
        if (month == 0) month = 12;
        
        int dayOfMonth = days;
        if (month > 1) {
            dayOfMonth -= CUMULATIVE_DAYS[monthIndex - 1];
        }
        String timeString = "" + getIntVariable(offset + 1);
        int length = 6 - timeString.length();
        for (int i = 0; i < length; i++) {
            timeString = "0" + timeString;
        }
        int hours = Integer.parseInt(timeString.substring(0, 2));
        int minutes = Integer.parseInt(timeString.substring(2, 4));
        int seconds = Integer.parseInt(timeString.substring(4, 6));
        return DateUtils.getTime(years, month, dayOfMonth, hours, minutes, seconds);
    }
Sample import configuration

...