public final class McIDASUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MCMISSING
McIDAS missing value for 4-byte integers
|
Constructor and Description |
---|
McIDASUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
bytesToInteger(byte[] b,
int off)
convert four consequtive bytes into a (signed) int.
|
static int[] |
bytesToIntegerArray(byte[] b,
int off,
int num)
convert consecutive bytes into a (signed) int array.
|
static int |
doubleLatLonToInteger(double dvalue)
Converts a double latitude/longitude to a packed integer (SIGN DDD MM SS)
Java version of McIDAS
ilalo function. |
static void |
flip(int[] array,
int first,
int last)
Flip the bytes of an integer array.
|
static AreaFile |
getAreaFile(String filename)
De-serialize an AreaFile object from disk
|
static String |
intBitsToString(int value)
convert signed int to a String representation.
|
static String |
intBitsToString(int[] values)
convert signed int array to a String representation.
|
static double |
integerLatLonToDouble(int value)
Converts a packed integer (SIGN DDD MM SS) latitude/longitude to double.
|
static boolean |
isChar(int value)
Check to see if the int value is the representation of a
string or not.
|
static GregorianCalendar |
makeCalendarForDayTimeToSecs()
Create a calendar to be used for mcDayTimeToSecs.
|
static long |
mcDateHmsToSecs(int date,
int time)
Convert date (yymmdd or yyyymmdd) and hms (hhmmss) to seconds since
the epoch (January 1, 1970, 00:00GMT).
|
static long |
mcDayTimeToSecs(int yearday,
int time)
Convert day (yyddd or yyyyddd) and time (hhmmss) to seconds since
the epoch (January 1, 1970, 00:00GMT).
|
static long |
mcDayTimeToSecs(int yearday,
int time,
GregorianCalendar cal)
Convert day (yyddd or yyyyddd) and time (hhmmss) to seconds since
the epoch (January 1, 1970, 00:00GMT).
|
static int |
mcDoubleToPackedInteger(double dvalue)
Converts a double latitude/longitude or time (hours) to a
packed integer (SIGN DDD/HH MM SS).
|
static String |
mcHmsToStr(int hms)
Convert an HMS integer to a string of form hh:mm:ss.
|
static double |
mcPackedIntegerToDouble(int value)
Converts a packed integer (SIGN DDD/HH MM SS) latitude/longitude
or time (hours) to double.
|
static int[] |
mcSecsToDayTime(long secs)
Convert seconds since the epoch (January 1, 1970, 00:00GMT) to
day (yyyyddd) and time (hhmmss).
|
static String |
padLeft(String s,
int desiredLength,
String padString)
Pad the given string with padString on the left up to the given length.
|
static String |
padZero(int value,
int numDigits)
Left pad the given value with zeros up to the number of digits
|
static boolean |
putAreaFile(String filename,
AreaFile af)
Serialize an AreaFile object to disk
|
static int |
swbyt4(int val)
Flip the bytes of an integer.
|
static void |
swbyt4(int[] array,
int first,
int num)
Flip the bytes of an integer array.
|
static double |
timdif(int yrday1,
int hms1,
int yrday2,
int hms2)
Calculate difference in minutes between two dates/times.
|
public static final int MCMISSING
public static double integerLatLonToDouble(int value)
flalo
function except returns a
double instead of a float.value
- integer containing the packed datapublic static int doubleLatLonToInteger(double dvalue)
ilalo
function.dvalue
- double value of lat/lonpublic static double mcPackedIntegerToDouble(int value)
flalo
and ftime
functions except returns a double instead of a float.value
- integer containing the packed datapublic static int mcDoubleToPackedInteger(double dvalue)
ilalo
and m0itime
functions.dvalue
- double value of lat/lon or timepublic static double timdif(int yrday1, int hms1, int yrday2, int hms2)
yrday1
- Year/day of first time (yyddd or yyyyddd)hms1
- Hours/minutes/seconds of first time (hhmmss).yrday2
- Year/day of second time (yyddd).hms2
- Hours/minutes/seconds of second time (hhmmss).public static GregorianCalendar makeCalendarForDayTimeToSecs()
public static long mcDayTimeToSecs(int yearday, int time)
yearday
- year/day in either yyddd or yyyyddd format.
Only works for years > 1900.time
- time in packed integer format (hhmmss)public static long mcDayTimeToSecs(int yearday, int time, GregorianCalendar cal)
yearday
- year/day in either yyddd or yyyyddd format.
Only works for years > 1900.time
- time in packed integer format (hhmmss)cal
- If non-null then use this calendar to do the formatting.
else create a new one. Note: The calendar you pass in should be
one created from makeCalendarForDayTimeToSecspublic static long mcDateHmsToSecs(int date, int time)
date
- year/day in yyymmdd format.
Only works for years > 1900.time
- time in packed integer format (hhmmss)public static int[] mcSecsToDayTime(long secs)
secs
- seconds since the epochpublic static String mcHmsToStr(int hms)
hms
- integer hhmmsspublic static String padZero(int value, int numDigits)
value
- The value.numDigits
- number of digitspublic static String padLeft(String s, int desiredLength, String padString)
s
- String to paddesiredLength
- ending lengthpadString
- String to pad with (e.g, " ")public static int swbyt4(int val)
val
- value to swappublic static void swbyt4(int[] array, int first, int num)
array
- array of integers to be flippedfirst
- starting element of the arraynum
- number of values to swappublic static void flip(int[] array, int first, int last)
array
- array of integers to be flippedfirst
- starting element of the arraylast
- last element of array to flippublic static int bytesToInteger(byte[] b, int off)
b
- array of 4 bytesoff
- is the offset into the byte arraypublic static int[] bytesToIntegerArray(byte[] b, int off, int num)
b
- array of bytesoff
- is the offset into the byte arraynum
- number of integers to createpublic static String intBitsToString(int value)
value
- - integer representation of a stringpublic static String intBitsToString(int[] values)
values
- - integer array representation of a stringpublic static boolean isChar(int value)
value
- integer representationpublic static boolean putAreaFile(String filename, AreaFile af)
filename
- - name of disk file to write toaf
- Copyright © 1996–2023 The SSEC Visualization Project. All rights reserved.