congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CalendarDate.getCalendar
Code IndexAdd Tabnine to your IDE (free)

How to use
getCalendar
method
in
ucar.nc2.time.CalendarDate

Best Java code snippets using ucar.nc2.time.CalendarDate.getCalendar (Showing top 18 results out of 315)

origin: edu.ucar/netcdf

private CalendarDateRange(CalendarDate start, CalendarDate end) {
 this.start = start;
 this.end = end;
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
 assert this.cal == end.getCalendar();
}
origin: edu.ucar/cdm

private CalendarDateRange(CalendarDate start, CalendarDate end) {
 this.start = start;
 this.end = end;
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
 assert this.cal.equals(end.getCalendar());
}
origin: Unidata/thredds

private CalendarDateRange(CalendarDate start, CalendarDate end) {
 this.start = start;
 this.end = end;
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
 assert this.cal.equals(end.getCalendar());
}
origin: edu.ucar/cdm

private CalendarDateUnit(Calendar calt, String dateUnitString) {
 dateUnitString = dateUnitString.trim();
 // dateUnitString = dateUnitString.replaceAll("\\s+", " ");  LOOK think about should we allow this ??
 dateUnitString = dateUnitString.toLowerCase();
 isCalendarField =  dateUnitString.startsWith(byCalendarString);
 if (isCalendarField) {
  dateUnitString = dateUnitString.substring(byCalendarString.length()).trim();
 }
 Matcher m = udunitPattern.matcher(dateUnitString);
 if (!m.matches()) {
  //System.out.printf("'%s' does not match regexp '%s'%n", dateUnitString, udunitPatternString);
  throw new IllegalArgumentException(dateUnitString + " does not match " + udunitPatternString);
 }
 unitString = m.group(1);
 periodField = CalendarPeriod.fromUnitString(unitString);
 int pos = dateUnitString.indexOf("since");
 String iso = dateUnitString.substring(pos + 5);
 baseDate = CalendarDateFormatter.isoStringToCalendarDate(calt, iso);
 // calendar might change !!
 calt = baseDate.getCalendar();
 this.cal = calt;
}
origin: Unidata/thredds

public ucar.nc2.time.Calendar getCalendar() {
 if (calendarDateRange != null)
  return calendarDateRange.getStart().getCalendar();  // LOOK
 return ucar.nc2.time.Calendar.getDefault();
}
origin: Unidata/thredds

private CalendarDateUnit(Calendar calt, String dateUnitString) {
 dateUnitString = dateUnitString.trim();
 // dateUnitString = dateUnitString.replaceAll("\\s+", " ");  LOOK think about should we allow this ??
 dateUnitString = dateUnitString.toLowerCase();
 isCalendarField =  dateUnitString.startsWith(byCalendarString);
 if (isCalendarField) {
  dateUnitString = dateUnitString.substring(byCalendarString.length()).trim();
 }
 Matcher m = udunitPattern.matcher(dateUnitString);
 if (!m.matches()) {
  //System.out.printf("'%s' does not match regexp '%s'%n", dateUnitString, udunitPatternString);
  throw new IllegalArgumentException(dateUnitString + " does not match " + udunitPatternString);
 }
 String unitString = m.group(1);
 period = CalendarPeriod.of(unitString);
 periodField = CalendarPeriod.fromUnitString(unitString);
 int pos = dateUnitString.indexOf("since");
 String iso = dateUnitString.substring(pos + 5);
 baseDate = CalendarDateFormatter.isoStringToCalendarDate(calt, iso);
 // calendar might change !!
 calt = baseDate.getCalendar();
 this.cal = calt;
}
origin: edu.ucar/cdm

public CalendarDateRange(CalendarDate start, long durationInSecs) {
 this.start = start;
 this.end = start.add((int) durationInSecs, CalendarPeriod.Field.Second );
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
}
origin: edu.ucar/netcdf

public CalendarDateRange(CalendarDate start, long durationInSecs) {
 this.start = start;
 this.end = start.add((int) durationInSecs, CalendarPeriod.Field.Second );
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
}
origin: Unidata/thredds

public CalendarDateRange(CalendarDate start, long durationInSecs) {
 this.start = start;
 this.end = start.add((int) durationInSecs, CalendarPeriod.Field.Second );
 this.startDt = start.getDateTime();
 this.endDt = end.getDateTime();
 this.cal = start.getCalendar();
}
origin: Unidata/thredds

CdmrFeatureProto.CalendarDateRange.Builder encodeDateRange(CalendarDateRange dateRange) {
 CdmrFeatureProto.CalendarDateRange.Builder builder = CdmrFeatureProto.CalendarDateRange.newBuilder();
 builder.setStart(dateRange.getStart().getMillis());
 builder.setEnd(dateRange.getEnd().getMillis());
 Calendar cal = dateRange.getStart().getCalendar();
 builder.setCalendar(convertCalendar(cal));
 return builder;
}
origin: Unidata/thredds

private VariableDS makeOffsetCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, double[] values) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName+"_offset", dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "offset hour from start of run for coordinate = " + dimName));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "forecast_period"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 // construct the values
 int ntimes = values.length;
 ArrayDouble.D1 timeCoordVals = (ArrayDouble.D1) Array.factory( DataType.DOUBLE, new int[] {ntimes}, values);
 timeVar.setCachedData(timeCoordVals);
 group.addVariable(timeVar);
 return timeVar;
}
origin: edu.ucar/cdm

private VariableDS makeOffsetCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, double[] values) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName+"_offset", dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "offset hour from start of run for coordinate = " + dimName));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "forecast_period"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 // construct the values
 int ntimes = values.length;
 ArrayDouble.D1 timeCoordVals = (ArrayDouble.D1) Array.factory( DataType.DOUBLE, new int[] {ntimes}, values);
 timeVar.setCachedData(timeCoordVals);
 group.addVariable(timeVar);
 return timeVar;
}
origin: edu.ucar/cdm

private VariableDS makeRunTimeCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, double[] values) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName+"_run", dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "run times for coordinate = " + dimName));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "forecast_reference_time"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));
 //timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));    
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base.getTimeUnits()  ));

 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 timeVar.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, AxisType.RunTime.toString())); // if theres already a time coord, dont put in coordSys - too complicated
 // construct the values
 int ntimes = values.length;
 ArrayDouble.D1 timeCoordVals = (ArrayDouble.D1) Array.factory( DataType.DOUBLE, new int[] {ntimes}, values);
 timeVar.setCachedData(timeCoordVals);
 group.addVariable(timeVar);
 return timeVar;
}
origin: Unidata/thredds

private VariableDS makeRunTimeCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, double[] values) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName+"_run", dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "run times for coordinate = " + dimName));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "forecast_reference_time"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));
 //timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));    
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base.getTimeUnits()  ));

 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 timeVar.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, AxisType.RunTime.toString())); // if theres already a time coord, dont put in coordSys - too complicated
 // construct the values
 int ntimes = values.length;
 ArrayDouble.D1 timeCoordVals = (ArrayDouble.D1) Array.factory( DataType.DOUBLE, new int[] {ntimes}, values);
 timeVar.setCachedData(timeCoordVals);
 group.addVariable(timeVar);
 return timeVar;
}
origin: Unidata/thredds

assert start.getCalendar() == Calendar.uniform30day;  // Using non-default calendar.
origin: Unidata/thredds

CalendarDate expected = CalendarDate.parseISOformat(Calendar.gregorian.toString(), "2002-12-01T00:00:00Z"); // CF i guess
Assert.assertEquals(expected.getMillis(), date.getMillis());
Assert.assertEquals(expected.getCalendar(), date.getCalendar());
Assert.assertEquals(expected, date);
origin: edu.ucar/cdm

private VariableDS makeTimeCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, FmrcInvLite.ValueB valueb) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName, dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "Forecast time for ForecastModelRunCollection"));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "time"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));    
 //timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));    
 
 //Ensure a valid udunit  
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base.getTimeUnits()));
   
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 timeVar.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, AxisType.Time.toString()));
 // construct the values
 int ntimes = valueb.offset.length;
 timeVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes}, valueb.offset));
 group.addVariable(timeVar);
 if (valueb.bounds != null) {
  String bname = timeVar.getShortName() + "_bounds";
  timeVar.addAttribute(new ucar.nc2.Attribute("bounds", bname));
  Dimension bd = ucar.nc2.dataset.DatasetConstructor.getBoundsDimension( result);
  VariableDS boundsVar = new VariableDS(result, group, null, bname, dtype, dimName+" " + bd.getShortName(), null, null);
  boundsVar.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for "+ timeVar.getShortName()));
  boundsVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes, 2}, valueb.bounds));
  group.addVariable(boundsVar);
 }
 return timeVar;
}
origin: Unidata/thredds

private VariableDS makeTimeCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, FmrcInvLite.ValueB valueb) {
 DataType dtype = DataType.DOUBLE;
 VariableDS timeVar = new VariableDS(result, group, null, dimName, dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D
 timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "Forecast time for ForecastModelRunCollection"));
 timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "time"));
 timeVar.addAttribute(new ucar.nc2.Attribute(CF.CALENDAR, base.getCalendar().name() ));    
 //timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base));    
 
 //Ensure a valid udunit  
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base.getTimeUnits()));
   
 timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN));
 timeVar.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, AxisType.Time.toString()));
 // construct the values
 int ntimes = valueb.offset.length;
 timeVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes}, valueb.offset));
 group.addVariable(timeVar);
 if (valueb.bounds != null) {
  String bname = timeVar.getShortName() + "_bounds";
  timeVar.addAttribute(new ucar.nc2.Attribute("bounds", bname));
  Dimension bd = ucar.nc2.dataset.DatasetConstructor.getBoundsDimension( result);
  VariableDS boundsVar = new VariableDS(result, group, null, bname, dtype, dimName+" " + bd.getShortName(), null, null);
  boundsVar.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for "+ timeVar.getShortName()));
  boundsVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes, 2}, valueb.bounds));
  group.addVariable(boundsVar);
 }
 return timeVar;
}
ucar.nc2.timeCalendarDategetCalendar

Popular methods of CalendarDate

  • getMillis
    Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.
  • of
  • toString
    ISO formatted string
  • parseISOformat
    Get CalendarDate from ISO date string
  • add
  • equals
  • getDifferenceInMsecs
    Get difference between two calendar dates in millisecs
  • isAfter
  • isBefore
  • toDate
    Get the equivilent java.util.Date
  • compareTo
  • getDateTime
  • compareTo,
  • getDateTime,
  • getHourOfDay,
  • parseUdunits,
  • present,
  • withDoy,
  • <init>,
  • getDifference,
  • getFieldValue

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • putExtra (Intent)
  • Permission (java.security)
    Legacy security code; do not use.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • ImageIO (javax.imageio)
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now