Skip to content

Commit

Permalink
styling
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 7, 2023
1 parent 2846bdf commit e95db31
Show file tree
Hide file tree
Showing 38 changed files with 159 additions and 169 deletions.
3 changes: 3 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,14 @@ dotnet_diagnostic.SA1119.severity = warning # Statement must not use unnece
dotnet_diagnostic.SA1124.severity = warning # Do not use regions
dotnet_diagnostic.SA1127.severity = warning # Generic type constraints must be on their own line or share line with previous
dotnet_diagnostic.SA1128.severity = warning # Put constructor initializers on their own line
dotnet_diagnostic.SA1137.severity = warning # Elements should have the same indentation
dotnet_diagnostic.SA1201.severity = warning # Elements must appear in the correct order
dotnet_diagnostic.SA1214.severity = warning # Readonly fields must appear before non-readonly fields
dotnet_diagnostic.SA1501.severity = warning # Braces must not be omitted
dotnet_diagnostic.SA1503.severity = warning # Braces must not be omitted
dotnet_diagnostic.SA1506.severity = warning # Element documentation header must not be preceded by blank line
dotnet_diagnostic.SA1507.severity = warning # Code should not contain multiple blank lines in a row
dotnet_diagnostic.SA1508.severity = warning # A closing brace must not be preceded by a blank line
dotnet_diagnostic.SA1513.severity = warning # Closing brace must be followed by blank line
dotnet_diagnostic.SA1514.severity = warning # Element documentation header must be preceded by blank line
dotnet_diagnostic.SA1515.severity = warning # Single-line comment must be preceded by blank line
Expand Down
1 change: 0 additions & 1 deletion src/DotNetStac/Collection/IStacSummaryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ public interface IStacSummaryItem : IEnumerable<JToken>
/// The summary item as a JToken
/// </value>
IEnumerable<object> Enumerate();

}
}
22 changes: 11 additions & 11 deletions src/DotNetStac/Collection/StacExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public StacExtent(StacSpatialExtent spatial, StacTemporalExtent temporal)
/// Initializes a new instance of the <see cref="StacExtent"/> class.
/// Initialize a new Stac Extent from an existing one (clone).
/// </summary>
/// <param name="extent"></param>
/// <param name="extent">The extent.</param>
public StacExtent(StacExtent extent)
{
this.Spatial = new StacSpatialExtent(extent.Spatial);
Expand Down Expand Up @@ -65,11 +65,11 @@ public static StacExtent Create(IEnumerable<StacItem> items)
minDate = minDate == DateTime.MinValue ? null : minDate;
maxDate = maxDate == DateTime.MaxValue ? null : maxDate;
return new StacExtent(
new StacSpatialExtent(
new StacSpatialExtent(
items.Min(i => i.GetBoundingBoxFromGeometryExtent()[0]),
items.Min(i => i.GetBoundingBoxFromGeometryExtent()[1]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[2]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[3])),
items.Min(i => i.GetBoundingBoxFromGeometryExtent()[1]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[2]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[3])),

new StacTemporalExtent(minDate, maxDate)
);
Expand All @@ -83,24 +83,24 @@ public object Clone()

internal void Update(ICollection<StacItem> items)
{
this.Spatial = new StacSpatialExtent(
this.Spatial = new StacSpatialExtent(
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[0])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][0] })
.Min(),
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[1])
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[1])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][1] })
.Min(),
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[2])
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[2])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][2] })
.Max(),
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[3])
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[3])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][3] })
.Max());
this.Temporal = new StacTemporalExtent(
this.Temporal = new StacTemporalExtent(
items.Select(i => i.DateTime.Start)
.Concat(new DateTime[] { this.Temporal.Interval[0][0].GetValueOrDefault() })
.Min(),
items.Select(i => i.DateTime.End)
items.Select(i => i.DateTime.End)
.Concat(new DateTime[] { this.Temporal.Interval[0][1].GetValueOrDefault() })
.Max());
}
Expand Down
1 change: 0 additions & 1 deletion src/DotNetStac/Collection/StacSummaryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ IEnumerator<JToken> IEnumerable<JToken>.GetEnumerator()
{
return this.summary.Children().GetEnumerator();
}

}
}
1 change: 0 additions & 1 deletion src/DotNetStac/Common/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,5 @@ public Statistics(double? minimum, double? maximum, double? mean, double? stdev,
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }

}
}
20 changes: 20 additions & 0 deletions src/DotNetStac/Exceptions/InvalidStacSchemaException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,43 @@

namespace Stac.Exceptions
{
/// <summary>
/// Exception thrown when the STAC schema is invalid
/// </summary>
[Serializable]
public class InvalidStacSchemaException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="InvalidStacSchemaException"/> class.
/// </summary>
public InvalidStacSchemaException()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InvalidStacSchemaException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public InvalidStacSchemaException(string message)
: base(message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InvalidStacSchemaException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public InvalidStacSchemaException(string message, Exception innerException)
: base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InvalidStacSchemaException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param>
protected InvalidStacSchemaException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Stac.Extensions.Alternate
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class AlternateAssetObject : IStacPropertiesContainer
{
private string href;
private readonly IStacObject _parent;
private string href;
private string title;

private string description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public AlternateAssetObject AddAlternate(string key, Uri uri, string title = nul
this.AlternateAssets = alternateAssets;
return alternateAssetObject;
}

}

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/DotNetStac/Extensions/Datacube/DatacubeDimensionObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public class DatacubeDimensionTemporal : DatacubeDimension
public DatacubeDimensionTemporal()
: base()
{

}
}

Expand All @@ -162,7 +161,6 @@ public class DatacubeDimensionAdditional : DatacubeDimension
public DatacubeDimensionAdditional()
: base()
{

}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/DotNetStac/Extensions/Eo/EoBandObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,5 @@ public EoBandObject(string name, EoBandCommonName? commonName)
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }

}
}
1 change: 0 additions & 1 deletion src/DotNetStac/Extensions/File/ByteOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ public enum ByteOrder
// Little Endian
[EnumMember(Value = "little-endian")]
LittleEndian

}
}
19 changes: 9 additions & 10 deletions src/DotNetStac/Extensions/File/FileStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public override IDictionary<string, ISummaryFunction> GetSummaryFunctions()
Dictionary<string, ISummaryFunction> summaryFunctions = new Dictionary<string, ISummaryFunction>();
return summaryFunctions;
}

}

/// <summary>
Expand All @@ -127,9 +126,9 @@ public static FileStacExtension FileExtension(this StacAsset stacAsset)
/// </summary>
public static async Task SetFileExtensionProperties(
this FileStacExtension fileStacExtension,
FileInfo file,
HashType hashType = HashType.SHA1,
MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
FileInfo file,
HashType hashType = HashType.SHA1,
MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
{
fileStacExtension.Size = Convert.ToUInt64(file.Length);
await fileStacExtension.SetFileCheckSum(hashType, encoding, uri => file.OpenRead());
Expand All @@ -142,9 +141,9 @@ public static async Task SetFileExtensionProperties(
/// </summary>
public static async Task SetFileExtensionProperties(
this FileStacExtension fileStacExtension,
Stream stream,
HashType hashType = HashType.SHA1,
MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
Stream stream,
HashType hashType = HashType.SHA1,
MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
{
await fileStacExtension.SetFileCheckSum(hashType, encoding, uri => stream);
}
Expand All @@ -154,9 +153,9 @@ public static async Task SetFileExtensionProperties(
/// </summary>
public static async Task SetFileCheckSum(
this FileStacExtension fileStacExtension,
HashType hashType,
MultibaseEncoding encoding,
Func<Uri, Stream> uriStreamer)
HashType hashType,
MultibaseEncoding encoding,
Func<Uri, Stream> uriStreamer)
{
Multihash mh = null;
using (var stream = uriStreamer(fileStacExtension.StacAsset.Uri))
Expand Down
16 changes: 8 additions & 8 deletions src/DotNetStac/Extensions/ItemCollection/ItemCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class ItemCollection : StacCollection, IStacExtension

public ItemCollection(
string id,
string description,
List<StacItem> stacItems)
string description,
List<StacItem> stacItems)
: base(
id,
description,
null)
description,
null)
{
if (stacItems != null)
{
Expand Down Expand Up @@ -83,23 +83,23 @@ internal static JSchema GenerateJSchema(string version)
{ "stac_version", new JSchema(){
Title = "STAC version",
Type = JSchemaType.String
}},
} },
{ "stac_extensions", new JSchema(){
Title = "STAC extensions",
Type = JSchemaType.Array,
UniqueItems = true,
Items = { new JSchema { Type = JSchemaType.String, Format = "uri", Title = "Reference to a JSON Schema" } }
}},
} },
{ "features", new JSchema(){
Title = "ItemCollection features",
Type = JSchemaType.Array,
Items = { new JSchema { Ref = itemSchema } }
}},
} },
{ "links", new JSchema(){
Title = "Links",
Type = JSchemaType.Array,
Items = { new JSchema { Ref = linkSchema } }
}},
} },
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ private void UpdateSoftwareField(object sender, NotifyCollectionChangedEventArgs
this.StacPropertiesContainer.SetProperty(SoftwareField, new Dictionary<string, string>(sender as IDictionary<string, string>));
this.DeclareStacExtension();
}

}

/// <summary>
Expand All @@ -128,9 +127,9 @@ public static ProcessingStacExtension ProcessingExtension(this StacItem stacItem
/// </summary>
public static void Init(
this ProcessingStacExtension processingStacExtension,
string lineage,
string level,
string facility = null)
string lineage,
string level,
string facility = null)
{
processingStacExtension.Lineage = lineage;
processingStacExtension.Level = level;
Expand Down
9 changes: 4 additions & 5 deletions src/DotNetStac/Extensions/Sar/SarStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,15 @@ public static StacAsset GetAsset(this StacItem stacItem, string polarization)

public static void Required(
this SarStacExtension sarStacExtension,
string instrumentMode,
SarCommonFrequencyBandName frequencyBandName,
string[] polarizations,
string productType)
string instrumentMode,
SarCommonFrequencyBandName frequencyBandName,
string[] polarizations,
string productType)
{
sarStacExtension.InstrumentMode = instrumentMode;
sarStacExtension.FrequencyBand = frequencyBandName;
sarStacExtension.Polarizations = polarizations;
sarStacExtension.ProductType = productType;
}
}

}
5 changes: 0 additions & 5 deletions src/DotNetStac/Extensions/Sat/BaselineCalculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public static BaselineVector CalculateBaseline(DateTime[] time, SatOrbitStateVec
double bAlong = b[0] * vaUnit[0] + b[1] * vaUnit[1] + b[2] * vaUnit[2];

return new BaselineVector(bPerp, bParallel, bAlong);

}

public static double[] VectorProduct3D(double[] vectorA, double[] vectorB)
Expand Down Expand Up @@ -279,7 +278,6 @@ private static double GetOrbitValue(double time, IInterpolation[] interpol, int
{

return interpol[index].Interpolate(time);

}

//---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -320,9 +318,6 @@ public static IInterpolation[] PolyInterpol(DateTime time0, SatOrbitStateVector[
coeff[8] = Interpolate.CubicSplineRobust(time, az1.ToArray());

return coeff;

}

}

}
1 change: 0 additions & 1 deletion src/DotNetStac/Extensions/Sat/BaselineVector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ public double Along
get { return this.along; }
}
}

}
1 change: 0 additions & 1 deletion src/DotNetStac/Extensions/Sat/SatStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private SortedDictionary<DateTime, SatOrbitStateVector> SortOrbitStateVectors(JT

return new SortedDictionary<DateTime, SatOrbitStateVector>(osvlist.ToDictionary(osv => osv.Time, osv => osv));
}

}

public static class SatStacExtensionExtensions
Expand Down
1 change: 0 additions & 1 deletion src/DotNetStac/Extensions/Sat/SatStacExtensionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static BaselineVector CalculateBaseline(this SatStacExtension sat1, SatSt
var baseline = BaselineCalculation.CalculateBaseline(times, masterOrbits.ToArray(), slaveOrbits.ToArray(), p0);

return baseline;

}
}
}
Loading

0 comments on commit e95db31

Please sign in to comment.